當使用Maven您可以通過執行以下控制部署的路徑:
的Tomcat的conf/tomcat的-users.xml中:
<tomcat-users>
<role rolename="manager-gui"/>
<role rolename="manager-script"/>
<role rolename="manager-jmx"/>
<role rolename="manager-status"/>
<role rolename="admin-gui"/>
<role rolename="admin-script"/>
<user username="root" password="root" roles="manager-gui,manager-script,manager-jmx,manager-status,admin-gui,admin-script"/>
</tomcat-users>
〜/ .m2目錄/ settings.xml中:
...
<server>
<id>tomcat</id>
<username>root</username>
<password>root</password>
</server>
...
的pom.xml:
...
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>myapp</artifactId>
<version>1.1.0</version>
<packaging>war</packaging>
...
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>tomcat-maven-plugin</artifactId>
<configuration>
<!-- neglect /html below Tomcat7: -->
<url>http://server:8080/manager/html</url>
<!-- Refer to the server settings in your ~/.m2/settings.xml -->
<server>tomcat</server>
<path>/myWebApp</path>
</configuration>
</plugin>
....
</plugins>
</build>
...
啓動Tomcat的第一 然後構建和部署應用程序..
mvn clean install tomcat:deploy
..它會根據http://server:8080/myWebApp
如果你只是想添加一個版本信息到您的文件名,請檢查我對這個問題的回答:http://stackoverflow.com/a/33822607/1458639 – 2015-12-03 10:49:45