Maven自动热部署到Tomcat服务器 步骤及注意:
1.修改tomcat/conf/tomcat-users.xml,内容如下:
<role rolename="manager"/>
<role rolename="admin"/>
<role rolename="manager-gui"/>
<role rolename="manager-script"/>
<role rolename="tomcat"/>
<role rolename="role1"/>
<user username="admin" password="for211314" roles="admin,manager,manager-gui,manager-script,tomcat,role1,admin,manager,manager-gui"/>
2.修改/新建maven/settings.xml,内容如下:
<server>
<id>central</id>
<username>admin</username>
<password>for211314</password>
</server>
3.配置完成后,重新启动tomcat服务器
4.配置pom.xml,内容如下:
<build>
<finalName>toll-server</finalName>
<plugins>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<url>http://10.28.10.106/manager</url>
<server>central</server>
<username>admin</username>
<password>for211314</password>
<port>80</port>
<path>/</path>
<uriEncoding>utf-8</uriEncoding>
</configuration>
</plugin>
</plugins>
</build>
备注:pom中的server与settings.xml的id需要一致