Removing version number from file name with Maven

前端 未结 3 1498
小蘑菇
小蘑菇 2021-02-03 17:49

I have a project with 5 modules in maven. Right now, when I do a \"mvn clean install\", it generates an ear containing the two jars, one war and one sar from the other modules.<

3条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-02-03 18:26

    Point one : single JAR/WAR.

    To create it without version number in name, in pom.xml simply add the code:

    
      ${project.artifactId}
    
    

    So, if you compile, for example projectx_misc, you get projectx_misc.jar .

    What happens to me? When I compile the same package from a POM project (in Netbeans), all the jars have the version in the name and the EAR include the xxx-version.jar archives.

    So, point two: the EAR problem.

    In the EAR's pom.xml file, change the maven-ear-plugin adding in the configuration this property:

    no-version
    

    This is my plugin setting for example:

    
       org.apache.maven.plugins
       maven-ear-plugin
       2.8
       
           6
           lib
           no-version
       
    
    

    So, now when i compile all the archives from a project pom, all the version numbers are removed from the jars.

提交回复
热议问题