当前位置: 代码迷 >> Web前端 >> 用maven 公布到tomcat
  详细解决方案

用maven 公布到tomcat

热度:155   发布时间:2012-07-22 19:31:17.0
用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

?

  相关解决方案