pom配置
- <plugin>
- <groupId>org.apache.tomcat.maven</groupId>
- <artifactId>tomcat7-maven-plugin</artifactId>
- <version>2.1</version>
- <configuration>
- <url>http://192.0.0.203:8080/manager/text</url>
- <server>server203</server>
- <path>/energy</path>
- </configuration>
- </plugin>
setting.xml
- <server>
- <id>unknown</id>
- <username>tomcat</username>
- <password>tomcat</password>
- </server>
tomcat配置有管理权限的用户:conf\tomcat-users.xml
- <?xml version='1.0' encoding='utf-8'?>
- <tomcat-users>
- <role rolename="manager"/>
- <user username="marshal" password="password" roles="manager"/>
- </tomcat-users>
相关命令
运行打包部署:
- mvn tomcat:deploy
撤销部署:
- mvn tomcat:undeploy
启动web应用:
- mvn tomcat:start
停止web应用:
- mvn tomcat:stop
重新部署:
- mvn tomcat:redeploy
部署展开的文件:
- mvn war:exploded tomcat:exploded
自动部署脚本
- echo [Step 1] tomcat7:undeploy
- call mvn tomcat7:undeploy
- if errorlevel 1 goto error
- echo [Step 1] tomcat7:undeploy
- call mvn tomcat7:deploy -Dmaven.test.skip=true
- if errorlevel 1 goto error
- goto end
- :error
- echo Error Happen!!
- :end
本配置仅适用tomcat7的maven插件,tomcat6请修改配置
最主要的是http://192.0.0.203:8080/manager/text ,参考官方文档
http://lookqlp.iteye.com/blog/1901550