how to Build project with maven without version

谁都会走 提交于 2019-11-28 16:28:50
prunge

You will always need a version number for a project, however it is possible to 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, the finalName is ${project.artifactId}-${project.version}, but this can be changed to something else. This will only affect the name of the package created in the target directory; the file name in the local repository and uploaded to remote repositories will always have a version number.

See the POM reference documentation for more information.

in maven war plugin in build, 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>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!