Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set filename of package generated by maven

Tags:

spring

maven

I've got a pom.xml file which builds an Java Spring artifact to a war-file. The war-file-name for the example below is always artifact 1.0.war

I want it to be just artifact.war because I need to deploy it to a Tomcat server where all url-configurations are overwritten.

How can I remove the version from the package file-name?

<project>
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.company</groupId>
  <artifactId>artifact</artifactId>
  <packaging>war</packaging>
  <version>1.0</version>
  <name>MyArtifact</name>
  ...
</project>
like image 761
Hedge Avatar asked Sep 14 '25 00:09

Hedge


1 Answers

You can give in the build section:

<build>
  ..
 <finalName>${artifactId}-${version}</finalName>
  ..
</build>

Or just change the context path in the web.xml (or may be in tomcat).

like image 179
khmarbaise Avatar answered Sep 16 '25 18:09

khmarbaise