1. Foreword
Automated deployment requires attention to docs, examples, Host-manager, manager, root in the WebApps directory under the Tomcat server and cannot be automatically deployed, and automated deployment starts the Tomcat service first.
Need to configure user information Tomcat/conf/tomcat-users.xml
<?xml version= ' 1.0 ' encoding= ' utf-8 '?>
<tomcat-users> <role rolename= ' Manager-gui '/>
<role rolename= "Manager-script"/> <role rolename= "manager-jmx"/> <role "rolename=
" Manager-status "/> <role rolename=" Admin-gui "/> <user username="
admin "password=" password " roles= "Admin-gui,manager-gui,manager-script,manager-status"/>
</tomcat-users>
2. Implement local automation deployment using cargo
2.1 Standalone Mode
* Container Node if local tomcat is not configured, it will be downloaded to the site itself, plus more convenient * cargo.servlet.port default is 8080 * Standalone mode, the project in ${ Project.build.directory}/tomcat directory boot, will copy local tomcat to the directory * Standalone advantages: Tomcat can be deployed within the project (copy a local tomcat into the ${
PROJECT.BUILD.DIRECTORY}/TOMCAT), different projects can be configured with different servers.
<!--using the command: (1) Clean (2) package (3) cargo:run-->
<plugin>
<groupid>org.codehaus.cargo</ groupid>
<artifactId>cargo-maven2-plugin</artifactId>
<version>1.6.4</version >
<configuration>
<container>
<containerId>tomcat7x</containerId>
Access path: http://localhost:8090/demo/hello.jsp 2.2 Existing mode
* Information ditto, do not configure container will download the online Tomcat
* Home configuration Deployed server, cargo.servlet.port Port
* Existing Advantages: Multiple items can be put into a tomcat.
<!--using the command: (1) Clean (2) package (3) cargo:run-->
<plugin>
<groupid>org.codehaus.cargo</ groupid>
<artifactId>cargo-maven2-plugin</artifactId>
<version>1.6.4</version >
<configuration>
<container>
<containerId>tomcat7x</containerId>
2.3 Command
Maven Build: Only one command executes directly, multiple selection boxes exist
Maven build ... : Create command
Maven Clean: Cleaning up the target directory
Maven install: Installing to a local repository
Maven test: Performing test directory Tests
Name: Custom names
Goals: Enter command 3. Remote automated deployment using cargo
Remote deployment in local virtual machine 192.168.128.130
<!--remote Deployment--> <!--use command: (1) Clean (2) package (3) Cargo:redeploy--> <plugin> <groupid>org.codeha Us.cargo</groupid> <artifactId>cargo-maven2-plugin</artifactId> <version>1.6.4</ version> <configuration> <container> <containerid>tomcat7x</containerid>
;<!--Tomcat version 7x 8x--> <type>remote</type><!--remote deployment--> </container> <configuration> <type>runtime</type> <properties> <c argo.hostname>192.168.128.130</cargo.hostname><!--ip--> <cargo.servlet.port>8080</
cargo.servlet.port><!--Port--> <cargo.protocol>http</cargo.protocol><!--Protocol--> <cargo.rmi.port>1099</cargo.rmi.port><!--Phuket What--> <cargo.remote.username& Gt;admin</cargo.remote.username><!--account password--> <cargo.remote.password>password</cargo.remote.password><!--account password--&
Gt <!--access Path--> <cargo.tomcat.manager.url>http://192.168.128.130:8080/</cargo.tomcat.manager.ur l> </properties> </configuration> </configuration> </plugin>
Access path: http://192.168.128.130:8080/demo/hello.jsp