Maven : How to avoid version appended to a war file in Maven?

11,874

Solution 1

Just add this to your pom.xml:

<build>
    <finalName>TataWeb</finalName>
</build>

Solution 2

You should use your artifactid, rather than hard-coding the file name.

<build>
  <finalName>${project.artifactId}</finalName>
</build> 
Share:
11,874
user1253847
Author by

user1253847

Updated on June 12, 2022

Comments

  • user1253847
    user1253847 about 2 years

    I am using Maven as the build file , this is my below settings for the war file name to be generated

    I am using Maven version 2.2.1

         <artifactId>TataWeb</artifactId>
    <packaging>war</packaging>
    <version>1.0</version>
    

    So its actually generating a war file with this name TataWeb-1.0

    But i want the war file name to be only TataWeb .

    Please let me know how can i avoid the version appeneded to the war file name ??

    Thank you .

  • user1253847
    user1253847 about 12 years
    I have 6 pom.xml files , one is parent one , where exactly i need to add this ??
  • Tomasz Nurkiewicz
    Tomasz Nurkiewicz about 12 years
    @user1253847: in the pom.xml responsible for generating WAR file, i.e. the one with <packaging>war</packaging>.
  • user1253847
    user1253847 about 12 years
    Ya i did that , but that did not work , still its generating with Tataweb-1.0.war , i have added the pom.xml file , please see .
  • Tomasz Nurkiewicz
    Tomasz Nurkiewicz about 12 years
    @user1253847: are you sure you are building your application with tata profile? Because the finalName is defined only there.
  • khmarbaise
    khmarbaise about 12 years
    The finalName will only prevent adding the information in the target folder but will not prevent the information added during deployment.
  • Damien
    Damien about 11 years
    Even though it is not the maven way, there are some cases when someone has to do this.
  • ironwood
    ironwood about 9 years
    Because, this will not install it to the local maven repo. So, file name changing angle, it is similar to build/finalName solution given above IMO.
  • Charles Morin
    Charles Morin over 6 years
    Much better like this. Thanks!