使用tomcat7+maven3 进行热部署,具体步骤如下:
第一步:安装tomcat7
第二步:配置tomcat 用户TOMCAT_HOME/conf/tomcat-users.xml
<tomcat-users>
<role rolename="manager-gui" />
<role rolename="manager-script" />
<user username="tomcat" password="tomcat" roles="manager-gui, manager-script" />
</tomcat-users>
第三步:修改TOMCAT_HOME/conf/tomcat-context.xml
<Context antiResourceLocking="true" antiJARLocking="true"/>
第四步:修改 MAVEN_HOME/conf/settings.xml
<pluginGroups>
<!-- pluginGroup
| Specifies a further group identifier to use for plugin lookup.
<pluginGroup>com.your.plugins</pluginGroup>
-->
<pluginGroup>org.apache.tomcat.maven</pluginGroup>
</pluginGroups>
第五步:在web pom.xml 中配置tomcate7插件
<!-- tomcate 自动部署 -->
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<url>http://localhost:8080/manager/text</url>
<server>tomcat</server>
<username>tomcat</username>
<password>tomcat</password>
</configuration>
</plugin>
第六步: mvn tomcat7:deploy 进行部署, mvn tomcat7:redeploy 进行重新部署