For help with installation, bugs reports or feature requests, please head over to our new forums.
Genuitec Community on GitHub
- This topic has 18 replies, 2 voices, and was last updated 19 years, 9 months ago by
twhphan.
-
AuthorPosts
-
twhphanMemberDear all,
I’m trying to port Spring’s jpetstore to MyEclipse and Maven 2
I created the following file structure:
mvn archetype:create -DgroupId=org.springframework.samples.jpetstore -DartifactId=jpetstore -DarchetypeArtifactId=maven-archetype-webappand used mvn eclipse:eclipse after I edited the pom.xml
However, without “Add WebProject Capabilities”, I cannot deploy the WAR to my app server (JES8.1) <- “project deployments”
How may I get this work, thx?
Thomas
November 14, 2005 at 11:39 am #241442
Riyad KallaMemberThomas,
There really isn’t a workaround here, if you want to deploy the project using MyEclipse’s deployment manager, you do need to tell MyEclispe that it’s a web project.Is there a reason you cannot add Web Project Capabilities.
November 14, 2005 at 8:00 pm #241476
twhphanMemberHi,
My reason is that I need Maven2 for build and deploy for the deployers (they don’t have IDE). The developers will use MyEclipse, but the file structure must follow the one Maven2 defines, including using libraries from the Maven2 local repository
November 14, 2005 at 9:30 pm #241477
Riyad KallaMemberI’m a bit confused:
My reason is that I need Maven2 for build and deploy for the deployers (they don’t have IDE)
From this, I understand that you are deploying the project with Maven, however in your original post you said:
However, without “Add WebProject Capabilities”, I cannot deploy the WAR to my app server (JES8.1) <- “project deployments”
which made me think you were deploying with MYEclipse… so basically I’m just confused about a) what the problem is and b) what you are trying to do. If you can set me straight on this I’m sure we can get this working for you.
November 14, 2005 at 9:40 pm #241478
twhphanMemberHi,
I want to deploy the wep app using MyEclipse, but the Eclipse project should be created by Maven 2 using mvn eclipse:eclipse (it’ll override MyEclipse’s setting from time to time)
If I don’t execute “Add WebProject Capabilities”, I couldn’t get the App Server listed in the “project deployments” dialog. But If I execute “Add WebProject Capabilities”, the Eclipse project will be changed and doesn’t look the same as the one created by Maven
Without MyEclipse, to deploy, I need to:
C:\workspace\jpetstore>mvn install
…
C:\workspace\jpetstore>”C:\Program Files\netbeans-4.1\SunAppServer8.1\bin\asadmin” deploy target\jpetstore.war
Command deploy executed successfully.Is there a way to enable deployment via both the IDE and Maven at the same time? Thx
November 15, 2005 at 7:34 am #241499
Riyad KallaMemberOk, so the trick here is going to be making “Add Web Project capabilities” look identical to how Maven has setup the project. The two directories we need to care about here are the WebRoot directory (you can name this whatever you want when you add capabilities) and the Output directory (typically WebRoot/WEB-INF/classes). As long as your project resembles an exploded WAR deployment, there shouldn’t be any problems. However if your web artifacts (web.xml, struts-config, faces-config, etc. etc.) are not under the WEB-INF dir someplace and instead exist in another location outside of the “WebRoot directory, this is going to keep you from successfully adding Web Capabilities, as MyEclipse assumes these locations. People in the past have worked around this by using Sym links on Linux and Windows (yes NTFS supports real-life sym links, need to google for it).
What is the format of your project (please wrap your text in code blocks using code button below so it maintains formatting).
November 15, 2005 at 8:41 pm #241566
twhphanMemberHi, the following is the default Maven2 file structure
src/ +--main/ +--java/ +--resources/ +--webapp/ +--images +--WEB-INF <- web.xml, applicationContext.xml, struts-config.xml etc +--jsp <- all JSPs r stored here, and referred by the Spring/Sturts controller target/ .classpath <- created by Maven 2's Eclipse plug-in .project <- created by Maven 2's Eclipse plug-in .wtpmodules <- created by Maven 2's Eclipse plug-in
The WEB-INF/lib is created by Maven via the local repository; the Eclipse’s .classpath file contains:
<classpath> <classpathentry kind="src" path="src/main/java"/> <classpathentry kind="src" path="src/main/resources"/> <classpathentry kind="output" path="target/classes"/> <classpathentry kind="var" rootpath="JRE_SRCROOT" path="JRE_LIB" sourcepath="JRE_SRC"/> <classpathentry kind="var" path="M2_REPO/javax/servlet/jsp-api/2.0/jsp-api-2.0.jar"/> <classpathentry kind="var" path="M2_REPO/junit/junit/3.7/junit-3.7.jar"/> <classpathentry kind="var" path="M2_REPO/commons-logging/commons-logging/1.0.4/commons-logging-1.0.4.jar"/> <classpathentry kind="var" path="M2_REPO/portlet-api/portlet-api/1.0/portlet-api-1.0.jar"/> <classpathentry kind="var" path="M2_REPO/commons-discovery/commons-discovery/0.2/commons-discovery-0.2.jar"/> <classpathentry kind="var" path="M2_REPO/commons-dbcp/commons-dbcp/1.2/commons-dbcp-1.2.jar"/> <classpathentry kind="var" path="M2_REPO/commons-beanutils/commons-beanutils/1.7.0/commons-beanutils-1.7.0.jar"/> <classpathentry kind="var" path="M2_REPO/axis/axis-saaj/1.3/axis-saaj-1.3.jar"/> <classpathentry kind="var" path="M2_REPO/javax/servlet/jstl/1.1.2/jstl-1.1.2.jar"/> <classpathentry kind="var" path="M2_REPO/axis/axis/1.3/axis-1.3.jar"/> <classpathentry kind="var" path="M2_REPO/commons-collections/commons-collections/3.1/commons-collections-3.1.jar"/> <classpathentry kind="var" path="M2_REPO/myfaces/myfaces-jsf-api/1.0.8-beta/myfaces-jsf-api-1.0.8-beta.jar"/> <classpathentry kind="var" path="M2_REPO/oro/oro/2.0.8/oro-2.0.8.jar"/> <classpathentry kind="var" path="M2_REPO/commons-fileupload/commons-fileupload/1.0/commons-fileupload-1.0.jar"/> <classpathentry kind="var" path="M2_REPO/axis/axis-jaxrpc/1.3/axis-jaxrpc-1.3.jar"/> <classpathentry kind="var" path="M2_REPO/xml-apis/xml-apis/2.0.2/xml-apis-2.0.2.jar"/> <classpathentry kind="var" path="M2_REPO/commons-digester/commons-digester/1.7/commons-digester-1.7.jar"/> <classpathentry kind="var" path="M2_REPO/burlap/burlap/2.1.7/burlap-2.1.7.jar"/> <classpathentry kind="var" path="M2_REPO/hsqldb/hsqldb/1.8.0.1/hsqldb-1.8.0.1.jar"/> <classpathentry kind="var" path="M2_REPO/struts/struts/1.2.7/struts-1.2.7.jar"/> <classpathentry kind="var" path="M2_REPO/javax/servlet/servlet-api/2.3/servlet-api-2.3.jar"/> <classpathentry kind="var" path="M2_REPO/springframework/spring/1.2.5/spring-1.2.5.jar"/> <classpathentry kind="var" path="M2_REPO/hessian/hessian/3.0.1/hessian-3.0.1.jar"/> <classpathentry kind="var" path="M2_REPO/commons-validator/commons-validator/1.1.4/commons-validator-1.1.4.jar"/> <classpathentry kind="var" path="M2_REPO/commons-chain/commons-chain/1.0/commons-chain-1.0.jar"/> <classpathentry kind="var" path="M2_REPO/commons-pool/commons-pool/1.2/commons-pool-1.2.jar"/> <classpathentry kind="var" path="M2_REPO/xerces/xerces/2.0.2/xerces-2.0.2.jar"/> <classpathentry kind="var" path="M2_REPO/antlr/antlr/2.7.2/antlr-2.7.2.jar"/> <classpathentry kind="var" path="M2_REPO/wsdl4j/wsdl4j/1.5.1/wsdl4j-1.5.1.jar"/> </classpath>
where M2_REPO is a variable in the workspace that points to Maven’s local repository
November 15, 2005 at 9:36 pm #241573
Riyad KallaMemberThis should be doable, add Web Capabilities:
1) Make your Web Root dir: /webapp
2) Make your source dir: /java
** After the project is created, add /resources as another source dir, it will be copied into the root of your /classes dir
3) After you finish the adding of web caps, edit the Java Build Path and change the output dir to /webapp/WEB-INF/classes
**4) You might need to create an empty /lib dir
5) Be sure to setup the deployment settings to deploy external JARs and/or USer Libraries depending on how you have the classpath for the project setup.
6) Go add all your JARs to your build pathNow try and deploy the project to Tomcat or whatever app server you are using.
November 16, 2005 at 1:40 am #241582
twhphanMemberAlmost worked, but the JARs under M2_REPO cannot be copied to WEB-INF/lib
I included them in the Java Build Path/Order and Export, but I have an empty WEB-INF/lib dir
November 16, 2005 at 8:23 am #241598
Riyad KallaMemberAlmost worked, but the JARs under M2_REPO cannot be copied to WEB-INF/lib
I included them in the Java Build Path/Order and Export, but I have an empty WEB-INF/lib dir
That should be fine, as long as you configured the deployment settings to deploy the other types of JARs you ahve added, all should be right with the world. Are you not seeing it working?
November 16, 2005 at 8:42 am #241602
twhphanMemberI couldn’t find the “deployment settings” to “deploy the other types of JARs I have added”. Is there a checkbox in the UI, where?
In my packaged archive (WAR), I couldn’t see WEB-INF/lib there after I unzipped it
Thx
November 16, 2005 at 9:14 am #241613
Riyad KallaMemberMy appologies, you can navigate to Window > Preferences > MyEclipse > J2EE Project > Web Project > Deployment tab
If you would like to change the settings only for a specific project and not for the entire workspace, open up your project properties and go to MyEclipse-Web and Deployment tab and you can change them there.
November 16, 2005 at 9:53 am #241629
twhphanMemberI checked “Jar dependent projects and place in the ‘lib’ directory”
but still not working, what still should I set
Sorry for asking this… This is my first MyEclipse deployment… Many thx
November 16, 2005 at 10:32 am #241633
Riyad KallaMemberChange that setting back to “Smart deployment”, what you should have checked is all the checkboxes below. Please note that we are trying to deploy the JARs in your build path, this has nothing to do with deploying “dependnt projects”.
If all those checkboxes *are* already checked, then I need to ask how you are adding those JARs to your build path. Are they external JARs? User libraries? what?
November 16, 2005 at 10:13 pm #241686
twhphanMemberAfter I checked all the checkboxes, I got
Deployment is out of date due to changes in the underlying project contents. You’ll need to manually ‘Redeploy’ the project to update the deployed archive
I tried to press the “Redeploy” button, but it also give me the same message
Thx
-
AuthorPosts