Reputation: 19307
I generated a war
file by executing this command in the root directory of my Spring
project : mvn package
The resulting war
file is called hib-1.0.0-BUILD-SNAPSHOT.war
I figured out that the first word hib
is the project's artifactId
.
How can I specify a custom name for the generated war
file?
Upvotes: 5
Views: 3686
Reputation: 9
just add following lines inside your pom.xml file and It works 100%
<configuration>
<finalName>customized project name</finalName>
</configuration>
these lines must put inside the plugin brackets like as:-
<build>
<plugins>
<plugin>
<configuration>
<finalName>customized project name</finalName>
</configuration>
</plugin>
</plugins>
</build>
Upvotes: 1
Reputation: 69440
You can set the variable finalName
in the build section of the pom.xml in your project:
<build>
<finalName>myname</finalName>
</build>
So the war will be renamed to myname.war
Upvotes: 6
Reputation: 22972
You can supply final name in build,
<build>
<finalName>my-project</finalName>
</build>
It will create my-project.war
when you package the application. By default it will consider following tags to name(my-project-0.0.1-SNAPSHOT.war
) the war file,
<groupId>com.in</groupId>
<artifactId>my-project</artifactId>
<version>0.0.1-SNAPSHOT</version>
Other than that you can always rename your war file before deploying it.
Upvotes: 3