How to build a project with maven without version

in one of my projects I need to build one project without a version. I have one call to the commonjerseylib project, when I create it using maven, I get commonjerseylib-1.0.war, but I need the name of the war file commonjerseylib.war

I remove the version tag from pom, but by default maven creates version 1.0.

Thank you in advance

<modelVersion>4.0.0</modelVersion> <groupId>commonjerseylib</groupId> <artifactId>commonjerseylib</artifactId> <packaging>ear</packaging> <name>commonjerseylib</name> <!--<version>1.0</version>--> 
+42
maven maven-2 version war
Mar 06 '12 at 23:19
source share
2 answers

You always need the version number for the project, however, you can change the name of the generated package (JAR, WAR, EAR, etc.) through the <finalName> element in the POM.

 <project> ... <build> ... <finalName>${project.artifactId}</finalName> ... </build> ... </project> 

or in older versions of maven:

  ... <finalName>${artifactId}</finalName> ... 

By default, finalName is set to ${project.artifactId}-${project.version} , but this can be changed to another. This will only affect the name of the package created in the target directory; the file name in the local repository and downloaded to the remote repositories will always have a version number.

See the POM reference documentation for more information.

+97
Mar 06 '12 at 23:33
source share

in maven war plugin in assembly, change

 <warName> ${artifactId} </warName> 



  <build> .......... <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-war-plugin</artifactId> <version>2.3</version> <configuration> <!-- web.xml is not mandatory since JavaEE 5 --> <failOnMissingWebXml>false</failOnMissingWebXml> <warName>${artifactId}</warName> </configuration> </plugin> ............. <build> 
+5
Oct 01 '15 at 7:14
source share



All Articles