According to the maven war plugin documentation I should be able to set the name of the generated war file with the parameter warName
. Is it not possible to do this from the command line with mvn -DwarName=mySpecificName package
? When I run maven like this the war file still gets the default name.
My webapp project is part of a multi module project and I only want to change the final name of the war file, not any other projects generated artifact.
I am using maven 3.0.4 and version 2.3 of the war plugin.
use the finalName tag to define/change the name of the war file in the web module that produces the war.
You can achieve the same effect by maven property.
1) Define a property via
<properties>
<my.warName>xxx</my.warName>
</properties>
You can overwrite the default value by "-Dmy.warName=commandlineWarName"
2) Redefine the war name
<build>
<finalName>${my.warName}</finalName>
<!-- ... -->
</build>
After looking at the code of the war plugin I realize that it is not possible to set the warName
parameter from command line. I assumed that all parameters were possible to set from the command line. This assumption was incorrect.
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