views:

61

answers:

1

Hi, due to the modular nature of some of our current applications, we have a need to understand how to setup Maven to produces mutliple configurations of the same artifact (in our case a WAR file), combinations of BOTH deployment level (dev, test, production) AND localised (gb, fr, es etc.)? We're looking for something like:

artifact-gb-dev.war
OR
artifact-fr-test.war (etc., etc.)

We've been made aware of Maven 'build profiles', which seem to fit the deployment environment criteria, and the 'maven-assembly-plugin', which might address the country/internationalisation issues BUT is it possible to combine the two (i.e. integrate French-language resources files into a production-level build)?

An example of our current directory structure might be:

..\gb
     \dev
     \test
     \production  
..\fr
     \dev
     \test
     \production  
..\es
     \dev
     \test
     \production

where a build might require a (one) French development release (fr/dev) OR all production releases (gb-fr-es-etc/prod), for example.

We're new to Maven and have decided to try it due to the quick ramp-up offered by pre-configured Maven archetypes and its dependency management. Until now we've used Ant for our builds.

Thanks

Richard

+1  A: 

Have a look at the maven war overlay mechanism. It basically allows you to have a generic pom and put overlays (for each country for example) on top of it to build any number of wars.

I've used this in the past to create a website (platform) for multiple countries with small differences per country.

See: http://maven.apache.org/plugins/maven-war-plugin/examples/war-overlay.html

Albert
Albert, does this require you to maintain a separate Maven project/pom for each country/dependency, or are the overlays applicable from within the one project (i.e. by defining new directories etc.)?
Big Rich
This would indeed require you to have a seperate module for each country. However you only override what's different from the parent so they can be small. I guess it really depends on your usecase wether this works for you.
Albert
Albert, I'll give it a go, thanks ;-)
Big Rich
Just came across this nice explanation of War overlays, with example code, hope this helps: http://javasplitter.blogspot.com/2009/08/loving-maven-webapp-overlays-and-jetty.html
Big Rich