eclipse maven tomcat7 热部署

1、在工程 pom文件中加入以下内容:

<plugin>  
    <groupId>org.apache.tomcat.maven</groupId>  
    <artifactId>tomcat7-maven-plugin</artifactId>  
    <version>2.0</version>  
    <configuration>  
        <url>http://localhost:8080/manager/text</url>   
        <server>tomcat</server>
        <username>admin</username>
        <password>admin</password>
        <path>/axp</path><!--根据工程打包名字进行修改-->
    </configuration>
</plugin>

 这样在build的时候 会下载并加载tomcat7的maven插件

2、修改tomcat7的配置文件(TOMCAT_HOME/conf/tomcat_users.xml),加入以下内容:

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

 3、在以前工作做完以后,先启动tomcat(一定要先启动)。然后在eclise中执行 run as ->run configer-maven.new 配置 goals:tomcat7:deploy.

猜你喜欢

转载自williamliu.iteye.com/blog/2009536