I have three profiles in my pom.xml for our application...
When we run our maven build all three profiles ouput a war file with the same name. I would like to output $profilename-somearbitraryname.war
Any ideas?
You can rename the WAR file if you are using a WAR file for deployment, and you want to use "Workplace XT" or a custom name for the context root of the application.
Maven looks for the pom. xml file, so you should rename it that for it to work. You could use another file name using the -f option. mvn -f parent-pom.
You've answered yourself correctly:
<profiles> <profile> <id>dev</id> <properties> <rp.build.warname>dev</rp.build.warname> </properties> </profile> <profile> <id>qa</id> <properties> <rp.build.warname>qa</rp.build.warname> </properties> </profile> <profile> <id>prod</id> <properties> <rp.build.warname>prod</rp.build.warname> </properties> </profile> </profiles>
but there is a simpler way to redefine WAR name:
<build> <finalName>${rp.build.warname}-somearbitraryname</finalName> <!-- ... --> </build>
No maven-war-plugin
is needed.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With