Maven--Cargo远程部署
https://codehaus-cargo.github.io/cargo/Tomcat+8.x.html
在 $TOMCAT_HOME/conf/tomcat_users.xml 下增加用户
修改 $TOMCAT_HOME/webapps/manager/META-INF/context.xml
注解 <Value> 一行。
可以在非部署机器上访问 tomcat,如果能点进去右边的管理菜单,则基本上差不多了。有问题也是 role 角色问题了。
下面是 demo 的 pom 文件
1 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 2 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> 3 <modelVersion>4.0.0</modelVersion> 4 <groupId>org.aisino.maven</groupId> 5 <artifactId>fpt-fpkj</artifactId> 6 <packaging>war</packaging> 7 <version>0.0.1-SNAPSHOT</version> 8 <name>fpt-fpkj Maven Webapp</name> 9 10 <properties> 11 <!-- 文件拷贝时的编码 --> 12 <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 13 <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> 14 <!-- 编译时的编码 --> 15 <maven.compiler.encoding>UTF-8</maven.compiler.encoding> 16 </properties> 17 18 <dependencies> 19 <dependency> 20 <groupId>junit</groupId> 21 <artifactId>junit</artifactId> 22 <version>4.7</version> 23 <scope>test</scope> 24 </dependency> 25 <dependency> 26 <groupId>servletapi</groupId> 27 <artifactId>servlet-api</artifactId> 28 <version>2.4</version> 29 <scope>provided</scope> 30 </dependency> 31 <dependency> 32 <groupId>javax.servlet.jsp</groupId> 33 <artifactId>jsp-api</artifactId> 34 <version>2.0</version> 35 <scope>provided</scope> 36 </dependency> 37 <dependency> 38 <groupId>commons-codec</groupId> 39 <artifactId>commons-codec</artifactId> 40 <version>1.9</version> 41 </dependency> 42 <dependency> 43 <groupId>org.apache.axis</groupId> 44 <artifactId>axis</artifactId> 45 <version>1.4</version> 46 </dependency> 47 <dependency> 48 <groupId>org.lucee</groupId> 49 <artifactId>jaxrpc</artifactId> 50 <version>1.4.0</version> 51 </dependency> 52 <dependency> 53 <groupId>wsdl4j</groupId> 54 <artifactId>wsdl4j</artifactId> 55 <version>1.6.1</version> 56 </dependency> 57 <dependency> 58 <groupId>commons-discovery</groupId> 59 <artifactId>commons-discovery</artifactId> 60 <version>0.2</version> 61 </dependency> 62 </dependencies> 63 <build> 64 <finalName>fpt-fpkj</finalName> 65 <plugins> 66 <plugin> 67 <groupId>org.codehaus.cargo</groupId> 68 <artifactId>cargo-maven2-plugin</artifactId> 69 <version>1.4.9</version> 70 <configuration> 71 <container> 72 <containerId>tomcat8x</containerId> 73 <type>remote</type> 74 </container> 75 <configuration> 76 <type>runtime</type> 77 <properties> 78 <cargo.remote.username>test</cargo.remote.username> 79 <cargo.remote.password>123456</cargo.remote.password> 80 <cargo.remote.uri>http://10.70.8.36:8080/manager/text</cargo.remote.uri> 81 </properties> 82 </configuration> 83 </configuration> 84 </plugin> 85 </plugins> 86 </build> 87 </project>
tomcat 版本不同,配置稍有变化,详情可以参考官方文档。