tomcat7插件进行热部署的问题。

首先要配置tomcat

我这里的tomcat是这样的

修改tomcat-user.xml这样:

如果是直接启动tomcat当然是可以的,但是我想在eclipse配置tomcat启动这样方便,

所以需要这样设置,

保存,运行run tomcat。

然后在maven项目中使用tomcat7插件进行热部署

 <build>
        <plugins>
            <plugin>
                <groupId>org.apache.tomcat.maven</groupId><!--组织-->
                <artifactId>tomcat7-maven-plugin</artifactId>
                <configuration>
                    <path>/</path> <!--访问路径-->
                    <port>8081</port> <!-- 端口号只用于run,如果是deploy就没有用url也是如此 -->
                    <url>http://localhost:8080/manager/text</url>
                    <server>tomcat7</server>
                    <username>tomcat</username>
                    <password>tomcat</password>
                </configuration>
            </plugin>
        </plugins>
    </build>
 
  这里面path 和 port是用于tomcat7的run的,而不是部署的。但是path必须要注释掉,不然打包的时候打成ROOT.war,而不是项目名.war。port在部署的时候无效,这样启动之后就能热部署了,即使war不用手动删除,打包,复制粘贴,并且重新运行项目。

猜你喜欢

转载自blog.csdn.net/a03910/article/details/82216313