Hi,
I am migrating a legacy app to maven and am having miserable time with one module in particular. The way the Ant script worked is that it built 3 or 4 artifacts from the same code base.
- secure-EJB.jar (some subset of classes)
- secure-EJB-client.jar (client EJB)
- unsecure-EJB.jar (another subset of classes)
- library.jar (regular java library with the bulk of classes, apart from the EJB beans/facades)
At first I tried to get Maven to build everything via a single pom, but that was just a recipe for disaster (and broke just about every maven convention I know), so I abandoned the concept altogether.
Instead, I ended up with 4 poms - each building to a separate target/ folder:
- pom.xml (parent pom, defines all the dependencies required for the build, and includes the 3 next poms as modules)
- pom-ejb-secure.xml (inherits pom.xml)
- pom-ejb-unsecure.xml (inherits pom.xml)
- pom-jar.xml (inherits pom.xml)
pom.xml (snippet):
<modelVersion>4.0.0</modelVersion>
<artifactId>ejb-pom</artifactId>
<groupId>org.myc</groupId>
<packaging>pom</packaging>
<modules>
<module>pom-securedEjb.xml</module>
<module>pom-unsecuredEjb.xml</module>
<module>pom-jar.xml</module>
</modules>
<properties>
<skipTests>true</skipTests>
</properties>
...
...
From a command line build (ex: mvn clean deploy), everything works properly, and as expected. All artifacts are independently built and deployed, at the cost of recompiling the classes for each pom.
However, I have no idea how to load/configure this in Eclipse/m2e such that it sees the different artifacts produced, and more importantly is able to resolve against them when referenced in other open projects (Enable Workspace Resolution).
When I import the maven project, it just "loads" the parent pom.xml and does not recognize that there are modules that need to be loaded/resolved as well.
Is there anything I can do about this?
Thanks,
Eric