用了一些部署工具:发现Cargo工具部署比较方便,特此推荐一下~
Cargo分为standalone和existing模式
standalone模式:会从Web容器目录复制一份配置到用户指定的目录,然后在此基础上部署应用,每次重新构建,这个目录会被清空,所有配置重新生成
existing:用户需要指定现有的Web容器配置目录, 然后Cargo会直接使用这些配置并将应用部署到对应的位置。
cargo不属于官方的。。 调用时候,用户需要添加到settings.xml中 。 不过用myeclipse 插件用全局的时候不需要配置也可以用命令直接运行
$ mvn cargo:start
01.<plugin>
02. <groupId>org.codehaus.cargogroupId>
03. <artifactId>cargo-maven2-pluginartifactId>
04. <version>1.1.3version>
05. <configuration>
06. <container>
07. <containerId>tomcat7xcontainerId>
08. <home>E:\tomcat\apache-tomcat-7.0.26home>
09. container>
10. <configuration>
11. <type>existingtype>
12. <home>E:\tomcat\apache-tomcat-7.0.26home>
13.
17. configuration>
18. configuration>
19. plugin>
<home> 就是需要部署的位置
当然Cargo也支持远程Web容器的部署
大体上配置差不多
01.<plugin>
02. <groupId>org.codehaus.cargogroupId>
03. <artifactId>cargo-maven2-pluginartifactId>
04. <version>1.1.3version>
05. <configuration>
06. <container>
07. <containerId>tomcat7xcontainerId>
08. <type>remotetype>
09. container>
10. <configuration>
11. <type>runtimetype>
12. <properties>
13. <cargo.remote.username>tomcatcargo.remote.username>
14. <cargo.remote.password>tomcatcargo.remote.password>
15. <cargo.remote.manager.url>http://localhost:8080/manager
16. properties>
17. configuration>
18. configuration>
19. plugin>
必须显示的指定type 否则cargo会默认的认为你是用installed(默认值)
命令: $mvn cargo:redeplo
远程部署时候,如果容器已经部署了当前应用,会卸载然后重新部署。
最后部署到tomcat中的war文件名为 你自己的maven项目的 artifactId + version