原型链原型链08-22 00:10

eclipse-maven项目使用maven的tomcat插件启动

1.tomcat-users.xml为maven添加账号

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

2.maven setting.xml添加tomcat用户

    <server>
       <id>tomcat</id>
       <username>tomcatuser</username>
       <password>tomcatpwd</password>
    </server>

3.pom.xml的 tomcat插件引入:

<plugin>
         <groupId>org.apache.tomcat.maven</groupId>
            <artifactId>tomcat7-maven-plugin</artifactId>
            <version>2.2</version>
               <configuration>
                  <path>/</path>
                  <port>8081</port>
                  <server>tomcat7</server>
               </configuration>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>run</goal>
                        </goals>
                    </execution>
                </executions>
        </plugin>
 <defaultGoal>compile</defaultGoal>

4.eclipse启动:

tomcat7:deploy  --部署一个web wartomcat7:reload  --重新加载web wartomcat7:start    --启动tomcat
tomcat7:stop    --停止tomcat
tomcat7:undeploy--停止一个wartomcat7:run 启动嵌入式tomcat ,并运行当前项目


程序之家二维码

000
评论