首页 > 代码库 > tomcat 热部署

tomcat 热部署

修改CATALINA_HOME \conf\tomcat-users.xml

 

<tomcat-users>
  <role rolename="manager-gui"/>
  <role rolename="manager-script"/>
  <user username="admin" password="admin" roles="manager-gui,manager-script"/>
</tomcat-users>

 

在maven的setting.xml中定义本机的tomcat,增加如下内容:
<servers>
 <server>
  <id>tomcat</id>
  <username>admin</username>
  <password>password</password>
 </server>
</servers>

 

在项目POM文件中增加

 <build>
  <finalName>app01a</finalName>
  <pluginManagement>
   <plugins>
    <plugin>
     <groupId>org.apache.tomcat.maven</groupId>
     <artifactId>tomcat6-maven-plugin</artifactId>
     <version>2.2</version>
    </plugin>
    <plugin>
     <groupId>org.apache.tomcat.maven</groupId>
     <artifactId>tomcat7-maven-plugin</artifactId>
     <version>2.2</version>
    </plugin>
   </plugins>
  </pluginManagement>
  <plugins>
   <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>
    </configuration>
   </plugin>
  </plugins>
 </build>

 

Run As 选择 Maven build,出现如下界面:

在Goals中添加点东西:package tomcat:redeploy

 

tomcat 热部署