標籤:style http color io os java ar art sp
1.配置standalone將本地tomcat伺服器配置拷貝下來,並運行在standalone指定的目錄下,可以運行為指定連接埠
[html] view plaincopy<plugin> <groupId>org.codehaus.cargo</groupId> <artifactId>cargo-maven2-plugin</artifactId> <version>1.2.4</version> <configuration> <container> <containerId>tomcat7x</containerId> <home>${env.CATALINA_HOME}</home> </container> <configuration> <type>standalone</type> <home>${project.build.directory}/target/tomcat7x</home> <properties> <cargo.servlet.port>9234</cargo.servlet.port> </properties> </configuration> </configuration> </plugin>
執行mvn package cargo:start
2.下載web伺服器並運行
[html] view plaincopy<container> <containerId>glassfish3x</containerId> <containerUrl>http://download.java.net/glassfish/3.1.1/release/glassfish-3.1.1.zip</containerUrl> </container>
執行mvn package cargo:start
3.通過existing方式運行
[html] view plaincopy<plugin> <groupId>org.codehaus.cargo</groupId> <artifactId>cargo-maven2-plugin</artifactId> <version>1.2.4</version> <configuration> <container> <containerId>tomcat7x</containerId> <home>${env.CATALINA_HOME}</home> </container> <configuration> <type>existing</type> <home>${env.CATALINA_HOME}</home> </configuration> </configuration> </plugin>
不能指定連接埠號碼,它直接運行指定位置的伺服器
執行mvn package cargo:start
4.配置到遠程web伺服器
[html] view plaincopy<plugin> <groupId>org.codehaus.cargo</groupId> <artifactId>cargo-maven2-plugin</artifactId> <version>1.2.4</version> <configuration> <container> <containerId>tomcat7x</containerId> <type>remote</type> </container> <configuration> <type>runtime</type> <properties> <cargo.hostname>localhost</cargo.hostname> <cargo.servlet.port>8080</cargo.servlet.port> <cargo.remote.username>tomcat</cargo.remote.username> <cargo.remote.password>tomcat</cargo.remote.password> </properties> </configuration> </configuration> </plugin>
運行mvn package cargo:redeploy,將war配置到localhost的port連接埠
運行mvn cargo:undeploy卸載war
maven 通過cargo配置運行到web伺服器