Maven (EJB) project with client and server artifacts

Posted by Cornel Masson on Stack Overflow See other posts from Stack Overflow or by Cornel Masson
Published on 2009-12-18T15:52:23Z Indexed on 2010/06/08 12:52 UTC
Read the original article Hit count: 225

Filed under:

Here's my variation on the "multiple artifacts from Maven build" question:

I'm porting from Ant to Maven. My application is an EJB server that is packaged as an EAR, but it also exposes a client JAR for use by other client apps. This jar contains the EJB interfaces, facade class and some helpers.

I know that the Maven way is to have one artifact per project (POM); however, both artifacts (server EAR and client JAR) need to be built from the same source tree - server and client share, for example, the EJB and 'home' interfaces.

How do I do this in Maven?

Do I have one project containing two POMs, say server-pom.xml & client-pom.xml? I was thinking I could also have a parent POM (pom.xml) that can be used to build both client and server with one foul swoop? However, the lifecycles diverge after the 'package' phase, since the server has to go through assembly (tar/gzip), while the client is done after 'package' and can simply be installed into the repository.

Any advice/experience on the best way to approach this?

© Stack Overflow or respective owner

Related posts about maven-2