views:

31

answers:

3

I googled around a bit and couldn't find any way to do it, but was wondering if I could have a project with multiple poms for various situations, then tell maven to use 'this' one or 'that' one.

The underlying issue is we have a project that needs to be built "for production" in one manner, and "for development" in another due to vagaries in WebSphere. I could hack up something with ant to switch in whatever pom I want by renaming it (i.e., "copy pom.xml.development pom.xml; mvn install"), but wondered if there were a more supported way.

Failing that, perhaps a way to "include" a section of pom from within a 'main' pom, so I could have my prod and dev snippets, and have maven include whichever one was appropriate based on a property or env var (or command line arg) or something?

+2  A: 

Consider using Maven profiles to build artifacts for a certain environment.

See: Introduction to build profiles

Stijn Van Bael
+3  A: 

The answer on question body is to use maven profiles.

The answer on question title is to issue

$ mvn -f my_custom_pom_filename.xml
igorp1024
Perfect, thanks.
A: 
mvn install -f myPOM.xml

OR mvn install --file myPOM.xml

To get the list of all command line options mvn --help

becomputer06