I have three profiles in my pom.xml for our application...
- dev (for use on a developer's)
- qa (for use on our internal qa server)
- prod (production).
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'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.
The answer was simple...
Define a property in each profile like this...
<profile>
<id>qa</id>
<properties>
<rp.build.warname>ourapp-qa</rp.build.warname>
</properties>
</profile>
Then add this to your plugins...
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
<configuration>
<packagingExcludes>WEB-INF/web.xml</packagingExcludes>
<warName>${rp.build.warname}</warName>
</configuration>
</plugin>
In maven you must use <bundleFileName>
in the <module>
You should follow this link to ensure your modules are rewritted:
http://maven.apache.org/plugins/maven-ear-plugin/examples/customizing-a-module-filename.html
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ear-plugin</artifactId>
<version>2.10.1</version>
<configuration>
[...]
<modules>
<ejbModule>
<groupId>artifactGroupId</groupId>
<artifactId>artifactId</artifactId>
<bundleFileName>anotherName-1.2.3.jar</bundleFileName>
</ejbModule>
</modules>
</configuration>
</plugin>
</plugins>
</build>