Maven cargo 远程自动部署war
如果不使用maven构建项目,则可以直接考虑将war包直接通过cargo远程部署到远端服务器上
(也就是说先创建个maven项目,打好包,再通过shell脚本,将所需要的项目打成war包,放到target目录下,对war包进行覆盖)。
打war包:
cd 项目目录,即WEB-INF所在目录
jar -cfM0 /app/proj-1.0-SNAPSHOT.war ./
1、创建maven项目
mvn archetype:generate
2、在pom.xml中配置maven-war-plugin和cargo-maven2-plugin
<build> <plugins> <plugin> <groupId>org.codehaus.cargo</groupId> <artifactId>cargo-maven2-plugin</artifactId> <version>1.4.9</version> <configuration> <container> <containerId>tomcat5x</containerId> <type>remote</type> </container> <configuration> <type>runtime</type> <properties> <cargo.remote.uri>http://你的IP:8080/manager</cargo.remote.uri> <cargo.remote.username>admin</cargo.remote.username> <cargo.remote.password>admin</cargo.remote.password> </properties> </configuration> <deployables> <deployable> <groupId>${project.groupId}</groupId> <artifactId>${project.artifactId}</artifactId> <type>war</type> <properties> <!-- 使用根路径,作为上下文 --> <context>/</context> </properties> <!-- 可选:验证是否部署成功 --> <pingURL>http://你的IP:8080</pingURL> <!-- 可选:验证超时时间,默认是120000 毫秒--> <pingTimeout>60000</pingTimeout> </deployable> </deployables> </configuration> </plugin> <!-- 本地部署 <plugin> <groupId>org.codehaus.cargo</groupId> <artifactId>cargo-maven2-plugin</artifactId> <version>1.4.0</version> <configuration> <container> <containerId>tomcat5x</containerId> <home>D:\Tomcat5.5</home> </container> <configuration> <type>existing</type> <home>D:\Tomcat5.5</home> </configuration> </configuration> </plugin> --> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-war-plugin</artifactId> <version>2.2</version> <configuration> <webXml>src\webapps\WEB-INF\web.xml</webXml> </configuration> </plugin> </plugins> </build> </project>
3、修改tomcat配置
Tomcat5.5\conf\server.xml
<Host
appBase="webapps"
name="localhost">
<!--上面cargo进行部署时使用的根路径,这里就不要配置了-->
<!-- Context path="" docBase="app" debug="0" reloadable="false" crossContext="true"/-->
<!--配置tomcat的manager http://localhost:8080/manager/html-->
<Context path="/manager" docBase="/app/Tomcat5.5/server/webapps/manager" debug="0" privileged="true"/>
</Host>
Tomcat5.5\conf\tomcat-users.xml 添加
<role rolename="admin"/>
<user username="admin" password="admin" roles="admin,manager"/>
Tomcat8 则使用
<role rolename="admin"/>
<user username="admin" password="admin" roles="admin,manager-script,manager-gui"/>
相关权限都可以在/webapps/manager/WEB-INFO/web.xml里找到
发布主要使用manager-script权限,界面的展示主要使用manager-gui权限
访问的地址:http://你的IP:你的端口/manager/
同时POM中的配置也需要调整:
<containerId>tomcat8x</containerId>
<cargo.remote.uri>http://127.0.0.1:8080/manager/text</cargo.remote.uri>
<configuration> <container> <containerId>tomcat8x</containerId> <type>remote</type> <timeout>120000</timeout> </container> <configuration> <type>runtime</type> <properties> <cargo.remote.uri>http://127.0.0.1:8080/manager/text</cargo.remote.uri> <cargo.remote.username>admin</cargo.remote.username> <cargo.remote.password>admin</cargo.remote.password> </properties> </configuration>
相关推荐
maven下使用Cargo实现自动化部署到tomcat7中cargo:deploy
maven自动部署war包到tomcat
maven-tomcat自动部署,配置文件
maven cargo插件远程部署web项目的简单案例,留作笔记,也分享给大家了!希望有所帮助
myeclipse中maven的一些常见功能总结;借助maven将本地项目部署到远程tomcat容器。
jenkins实现maven项目自动部署到tomcat 实现自动部署,
jenkins+git+maven搭建自动化部署环境说明文档,详尽的说明
工作目的:实现自动化部署工作,以期提高开发项目的工作效率; 工作内容:利用开源的可持续集成工具,实现java项目的自动编译、打包、发布等工作流程; 具体工作内容如下: 一、 自动化部署的环境搭建; 二、 Maven...
maven自动部署到远程普通tomcat6服务器!
tomcat_maven远程部署配置文档 tomcat_maven远程部署配置文档
NULL 博文链接:https://jdonee.iteye.com/blog/774387
使用maven插件,可以把java web项目远程部署到tomcat容器,免去了手工拷贝的重复造轮子。 maven
maven依赖war构件 技术交流希望 这个工程简单的介绍一下怎么在开发环境
将Eclise中的Maven工程自动部署到nexus服务器
NULL 博文链接:https://ailikes.iteye.com/blog/2229719
使用maven 对java程序编译构建,打包和部署。自动化部署
maven的一个简单示例, 顺便还有 distributionManagement 模块,ftp
jenkins+git+maven搭建自动化部署环境
NULL 博文链接:https://a601167866.iteye.com/blog/1561410