Java – Multi Module Maven2 Project with WTP

eclipseeclipse-wtpjavamaven-2

I'm having a hard time to make my Maven2 multi module project, with a deep project structure, appear as a single ear (with its dependencies – which includes 1 war, 2 ejbs and 1 jar) to be deployed in my JBOSS 5 server inside my Eclipse Ganymede (tab Servers).

I've been trying to use Maven Eclipse Plugin to turn my projects into a WTP project without success. Therefore they appear to be deployed in the server they appear as separated projets.

My project has 1 war, 2 ejbs and 1 jar that must be packaged inside an ear, each of the "subprojects" is a separate module.

Project's pom.xml (type pom):

<modules>
   <module>ejb1</module>
   <module>ejb2</module>
   <module>war</module>
   <module>jar</module>
   <module>ear</module>
</modules>

The ear module is only responsable to pack the other modules together.

Is there a way to tell eclipse (ganymede) that all those projects (ejbs, war and jar) are inside the ear module so I can deploy the ear in the server?

Best Answer

What you want to do is have maven create the eclipse projects via mvn eclipse:eclipse This might be helpful.