Tomcat热部署(Myeclipse)

简介:Tomcat热部署主要用于程序员开发中,每次在后端做了修改,都要频繁开启tomcat服务器

             耗时,麻烦。而做出的改进。

笔者开发工具:myeclipse2014+tomcat7+jdk7

 

1:在tomcat中做出的修改

在apache-tomcat-7.0.55\conf\tomcat-users.xml中进行修改

</tomcat-users>

         <role rolename="tomcat" />

         <role rolename="manager-gui" />

         <role rolename="manager-script" />

         <user username="tomcat" password="tomcat"

         roles="tomcat,manager-gui,manager-script" />

</tomcat-users>

 

2:在myeclipse中进行相关配置

2.1:在pom.xml中配置

<build>

      <plugins>

           <plugin>

                 <groupId>org.apache.maven.plugins</groupId>

                <artifactId>maven-compiler-plugin</artifactId>

                <version>3.3</version>

                <configuration>

                <source>1.7</source>

                <target>1.7</target>

                </configuration>

            </plugin>

            <plugin>

                    <groupId>org.apache.tomcat.maven</groupId>

                    <artifactId>tomcat7-maven-plugin</artifactId>

                    <version>2.2</version>

                     <configuration>

                     <port>8080</port>

                     <path>/</path>

                     <url>http://localhost:8080/manager/text </url>

                     <username>tomcat</username>

                     <password>tomcat</password>

                      </configuration>

                </plugin>

      </plugins>

</build>

 

2.2:在当前项目上右键 - Run As - Maven build

在当前界面的Goals中输入:clean tomcat7:redeploy -DskipTests

点击 Run 运行

Tomcat热部署(Myeclipse)

3.整体介绍

3.1:启动顺序,先启动Tomcat服务器,在启动myeclipse中的Run(启动两个)

3.2:启动规则,在启动tomcat服务器必须以Debug模式启动才会使热部署生效。(debug模式启动)