Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to use a file other than one named "pom.xml" for maven 2?

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?

like image 445
Michael Campbell Avatar asked Dec 28 '22 10:12

Michael Campbell


1 Answers

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
like image 75
igorp1024 Avatar answered Jan 06 '23 03:01

igorp1024