|
Standalone Maven2 installation (2.2.1) + M2Eclipse 0.10 plugin + 0.10 extra WTP integration.
1. Multimodule project (under SVN) myproject\codebase pom.xml (includes modules) \modules pom.xml (includes the different submodules) \<moduleX> \... \<moduleEAR> \<moduleWAR> 2. Run mvn clean from within myproject\codebase from cmdline (Maven 2.2.1 used). 3. Remove all .* files from above directory structure. 4. Start Eclipse. (Maven embedder not selected, standalone Maven 2.2.1 selected instead) 5. Import Existing Maven Projects * myprojects\codebase selected as root directory. * all other settings on the import dialog box at their defaults. * import projects. * everything goes fine. * Eclipse project properties - J2EE Module Dependencies of the EAR project correctly shows mywar-1.0.0.war as a dependency. 6. Deploy to Glassfish server (using glassfish plugin) goes fine. 7. Run As Maven ... (eg test) also goes fine. 8. Exit Eclipse. 9. Start Eclipse. 10. Deployment to glassfish no longer works because project's J2EE Module Dependencies have changed suddenly. Instead of mywar-1.0.0.war the J2EE Module Dependencies of the EAR roject now reference mywar.war instead => version dropped !!??. Upon deploying glassfish/eclipse suddenly produces an ear containing a mywar.war, but application.xml still correctly mentions (web-uri) mywar-1.0.0.war. Upon deployment, things fail because a mywar-1.0.0.war is expected but a mywar.war was produced and made part of the EAR. Therefore I get a deployment exception because file was not found. What is happening here ? I did not have this on Eclipse 3.5.1, m2eclipse 0.9.8, maven embedder 2.1.0... Using that configuration I can restart Eclipse without my J2EE Module Dependencies changing. Is this a bug, can this be fixed ? If not what workaround can I apply ? Urgent. Thanks, EDH --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
|
Yes this is a bug. Can you open a JIRA issue please?(https://issues.sonatype.org/browse/MNGECLIPSE)
As a workaround, you can specify the bundleFileName in your maven-ear-plugin to match the version-less names generated by WTP. <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-ear-plugin</artifactId> <version>2.3.2</version> <configuration> <version>5</version> <defaultLibBundleDir>lib</defaultLibBundleDir> <!-- project bundlefilenames are overridden to avoid nasty bugs in Eclipse WTP : - After a workspace restart, WTP might not match a project name with the archive name it's supposed to deploy - the Glassfish WTP connector won't deploy projects having dots in their name --> <modules> <webModule> <groupId>foo.bar</groupId> <artifactId>myweb</artifactId> <contextRoot>/myweb</contextRoot> <bundleFileName>myweb.war</bundleFileName> </webModule> <ejbModule> <groupId>foo.bar</groupId> <artifactId>myejb</artifactId> <bundleFileName>myejb.jar</bundleFileName> </ejbModule> </modules> </configuration> </plugin> If you really want to keep the version # in your final ear (generated with maven), you should be able to use a m2e profile for specific eclipse config like this : <profiles> <!-- Add a dedicated m2eclipse profile, to prevent the Java Builder to be added to the project in Eclipse (see http://tiny.cc/NoJavaInEar)--> <profile> <id>m2e</id> <activation> <property> <name>m2e.version</name> </property> </activation> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-ear-plugin</artifactId> <version>2.3.2</version> <configuration> <version>5</version> <defaultLibBundleDir>lib</defaultLibBundleDir> <!-- project bundlefilenames are overridden to avoid nasty bugs in Eclipse WTP : - After a workspace restart, WTP might not match a project name with the archive name it's supposed to deploy - the Glassfish WTP connector won't deploy projects having dots in their name --> <modules> <webModule> <groupId>foo.bar</groupId> <artifactId>myweb</artifactId> <contextRoot>/myweb</contextRoot> <bundleFileName>myweb.war</bundleFileName> </webModule> <ejbModule> <groupId>foo.bar</groupId> <artifactId>myejb</artifactId> <bundleFileName>myejb.jar</bundleFileName> </ejbModule> </modules> </configuration> </plugin> <plugin> <!-- org.maven.ide.eclipse:lifecycle-mapping is not a real, existing plugin --> <groupId>org.maven.ide.eclipse</groupId> <artifactId>lifecycle-mapping</artifactId> <version>0.10.0</version> <configuration> <mappingId>customizable</mappingId> <configurators> <configurator id='org.maven.ide.eclipse.configuration.wtp.configurator' /> </configurators> <mojoExecutions> <mojoExecution>org.apache.maven.plugins:maven-resources-plugin::</mojoExecution> </mojoExecutions> </configuration> </plugin> </plugins> </build> </profile> </profiles> If that doesn't fit your needs, there's still a manual (yiiiikes) operation you can do : in ear/.settings/org.eclipse.wst.common.component add an archiveName attribute to your project modules like : <dependent-module deploy-path="/" archiveName="mywar-1.0.0-SNAPSHOT" handle="module:/resource/mywar/mywar"> Hope this helps. regards, Fred Bricon On Tue, Feb 23, 2010 at 12:04 PM, Dhondt, Edwin <[hidden email]> wrote: Standalone Maven2 installation (2.2.1) + M2Eclipse 0.10 plugin + 0.10 extra WTP integration. |
|
I opened a JIRA issue yesterday (http://issues.sonatype.org/browse/MNGECLIPSE-2123). In the meanwhile thanks for the provided workarounds. Regarding those workarounds. I understand the first one and the third one. The second one sounds the most interesting though, but I don’t
fully understand it yet. I guess the xml snippet must be added to each of my ear module pom’s
(if I have multiple ear modules) ? Further, in this workaround the m2e profile will be
active/activated when the m2e.version property is present. That’s correct
no ? Can you clarify a bit then how, when starting Eclipse/when working in
Eclipse, everything will work thanks to this profile ? How does this profile prevent the Java Builder from being added to
my ear project ? Will the m2eclipse plugin detect on startup of Eclipse or when
working in Eclipse that this profile is active ? If yes, where is this m2e.version property defined then, or is it a
“well-known/standard m2eclipse” property ? Can you clarify a bit please ? Thanks. EDH From: Fred
Bricon [mailto:[hidden email]] Yes this is a bug. Can you open a JIRA issue
please?(https://issues.sonatype.org/browse/MNGECLIPSE) On Tue, Feb 23, 2010 at 12:04 PM,
Dhondt, Edwin <[hidden email]>
wrote: Standalone Maven2 installation (2.2.1) + M2Eclipse
0.10 plugin + 0.10 extra WTP integration. |
|
m2e profile activation is explained in the wiki
https://docs.sonatype.org/pages/viewpage.action?pageId=2949459
Basically, you tell m2eclipse which configurators will be applied to a project, which mojo will participate to the build. Each EAR module/project should configure this profile. I've set up a couple archetypes preconfigured for m2e at http://code.google.com/p/open-archetypes/ regards, Fred Bricon On Tue, Feb 23, 2010 at 3:43 PM, Dhondt, Edwin <[hidden email]> wrote:
|
| Powered by Nabble | Edit this page |
