Changing name of WAR file produced by maven build step?

I'm trying to change the name of the WAR file produced by a Maven build step in Teamcity which is essentially 'maven clean package'.

For various reasons, changing the WAR filename in Teamcity is preferable to e.g. editing the pom.xml file - we need the name it always spits out now (myapp-version.war) in most cases, but I need my Teamcity build step to spit out myapp-version-buildnumber.war.

I've tried to set Maven's build.finalName property as a Build Parameter and by using -D on the command line and neither works.  Can anyone help?  Here's a screenshot of my Build Paramter, which looks like a better way to do this than command line options, if possible.


Comment actions Permalink

Trying now:     %maven.project.artifactId%-%maven.project.version%-%build.number%

But, waiting half an hour on the build queue.  :(

Edit: didn't work either.

Comment actions Permalink


Unfortunately, Maven does not allow to override finalName value directly from command line and TeamCity is of little help here.

You should add custom property to your pom.xml with reasonable default e.g.


Use it as final name:


and then override it (command line, custom profile, anything)


Please sign in to leave a comment.