2

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

Big Rich
  • 5,864
  • 1
  • 40
  • 64
  • It occured to me that we *might* be be able to alter the maven-assembly-plugin's directory resolution by employing variables tied to a particular profile, say by introducing the deployment level into the config/resource's directory path (e.g. /src/main/config/lang/${profile.level}/...). The assembly plugin would then handle the various localisation requirements via numerous executions... – Big Rich Sep 13 '10 at 10:35

1 Answers1

2

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
  • 2,125
  • 1
  • 19
  • 24
  • 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 Sep 13 '10 at 13:26
  • 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 Sep 14 '10 at 19:18
  • 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 Sep 18 '10 at 01:31