views:

244

answers:

3
+1  A: 

You could use profiles see http://maven.apache.org/guides/mini/guide-building-for-different-environments.html and use classifiers to distinguish between the artifacts from the different builds for the same version. In this setup, you could create additional optional modules for each of your clients specific customisations under the parent project i.e.
+ PM
++ PM-Core
++ PM-Web
++ PM-Client1
++ PM-Client2

Or you could look at using use the maven assembly plugin

crowne
Thanks for the suggestions; they both seem like possible solutions. I've tried overlays first since that feels like the best candidate at the moment.
TheStijn
+1  A: 

Yes, this can be done using Overlays. The sample on the webpage is exactly what you are talking about.

For the project structure, you could have something like this:

.
|-- PM-Core
|-- PM-WebCommon (of type war, depends on core)
|-- PM-Client1 (of type war, depends on webcommon)
`-- PM-Client2 (of type war, depends on webcommon)

And use overlay in PM-Client1 and PM-Client2 to "merge" them with PM-WebCommon and package wars for each client.

UPDATE I won't cover all the details but I think that declaring the war dependency with a scope of type runtime is required when using overlay, this is how overlay do work (actually, the whole overlay thing is a kind of hack). Now, to solve your eclipse issue, one solution would be to create a JAR containing the classes of the PM-WebCommon project. To do so, use the attachClasses optional parameter and set it to true. This will tell maven to create a PM-WebCommon-<version>-classes.jar that you'll then be able to declare as dependency in PM-Client1 (with a provided scope). For the details, have a look at MWAR-73 and MWAR-131. This is also discussed in the FAQ of the war plugin. Note that this is not a recommended practice, the right way would be to move the classes to a separate module (and this is the other solution I wanted to mention).

UPDATE (201001018): I've tried the attachClasses parameter and it works with version 2.1-beta-1 of the plugin.

Pascal Thivent
+1  A: 

Compare also the answers for question different WAR files, shared resources .

hstoerr