用maven 发布到tomcat

mvn tomcat:run

mvnDebug tomcat:run 
 

1.pom.xml安装tomcat-maven-plugin

<build>
<finalName>myproj</finalName>
<plugins>
    <plugin>  
	<groupId>org.codehaus.mojo</groupId>  
	<artifactId>tomcat-maven-plugin</artifactId>  
	<configuration>  
	    <url>http://localhost:8080/manager/html</url>  
	    <server>tomcatServer</server>  
	    <path>/myproj</path>  
	</configuration>  
    </plugin>
</plugins>
</build>

 

2.设置settings.xml

<server>  
         <id>tomcatServer</id>  
         <username>admin</username>  
         <password>password</password>  
</server>

 

3.设置tomcat-users.xml

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

 并且webapps目录可写,并启动tomcat

 

4.用maven2发布war包
  4.1发布一个war文件
 
mvn tomcat:deploy
 
 
  4.2发布一个张开的war
  mvn war:exploded tomcat:exploded
mvn war:exploded tomcat:exploded
 

5 在eclipse中配置远程调试

MAVEN命令:

mvn war:exploded tomcat:exploded
mvn tomcat:deploy
mvn tomcat:undeploy

mvn tomcat:undeploy tomcat:exploded

mvn tomcat:exploded

 

你可能感兴趣的:(tomcat)