相关文章推荐
豪情万千的茶叶  ·  贝叶斯神经网络系列教程(二):背景知识 - ...·  2 年前    · 
会开车的草稿本  ·  腾讯云开发者社区技术沙龙第29期回顾-高效智 ...·  2 年前    · 
霸气的蚂蚁  ·  生成随机颜色 - 方帅 - 博客园·  2 年前    · 
刚分手的毛衣  ·  Section 6. 微分方程式·  3 年前    · 
Code  ›  Jenkins+SVN+tomcat持续集成发布开发者社区
info 持续集成 jenkins
https://cloud.tencent.com/developer/article/1394279?areaId=106001
英俊的黑框眼镜
2 年前
作者头像
肖哥哥
0 篇文章

Jenkins+SVN+tomcat持续集成发布

前往专栏
腾讯云
开发者社区
文档 意见反馈 控制台
首页
学习
活动
专区
工具
TVP
文章/答案/技术大牛
发布
首页
学习
活动
专区
工具
TVP
返回腾讯云官网
社区首页 > 专栏 > 后台及大数据开发 > Jenkins+SVN+tomcat持续集成发布

Jenkins+SVN+tomcat持续集成发布

作者头像
肖哥哥
发布 于 2019-02-22 11:11:08
811 0
发布 于 2019-02-22 11:11:08
举报

有代码更新后重新打包到tomcat再发布,是不是很烦?

看了下面的东西你就不会烦了。

SVN或者git等代码版本控制工具不说了,如果是本地开发,也可以安装一个svn server端

jenkins下载后是一个war包,

首先设置下 环境变量   JENKINS_HOME  为 c:\jenkins

拷贝到一个tomcat的webapp目录下启动tomcat保证能正常访问

http://localhost:8880/jenkins/  多个tomcat请注意修改端口

打开后第一次没任何项目,新建一个项目   maven项目,怎么创建maven项目  请参考我的博客其他文章

必填项:

项目名称:   随意了,自己喜欢就好 O(∩_∩)O哈哈~

下面填写自己的svn cvs等信息,地址及用户名密码

往下: 请勾选  Build whenever a SNAPSHOT dependency is built 这个复选框

再往下就是配置构建成功后发布信息的,这个首先得安装一个插件

安装Deploy to container Plugin 插件,安装成功后才能自动发布

安装好后重启下服务器最好

构建后操作,选择安装好插件后的 deploy war to container,

输入target目录下生成的war包,

配置远程的tomcat,并保证可以登录到manage界面,配置的tomcat处于启动状态

注意:

tomcat默认是没有用户可以登录的  需要修改 conf下的user.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"/>
  <user password="tomcat" roles="manager-gui,manager-script,manager-jmx,manager-status" username="tomcat"/>
</tomcat-users>

同时记得修改tomcat/conf/context.xml

<Context antiResourceLocking="true"> 

修改这个主要是为了解决再次部署的时候,不能删除原项目部署目录,详情可参考 http://tomcat.apache.org/tomcat-7.0-doc/config/context.html 搜索 lock

配置完成,点击应用  保存

然后创建,失败是红色,具体信息看控制台,成功后的log大致如下:

Started by user anonymous
Building in workspace c:\jenkins\workspace\demo
Updating https://xiaochangwei/svn/demo1/Test001 at revision '2015-11-10T12:59:10.009 +0800'
At revision 7
no change for https://xiaochangwei/svn/demo1/Test001 since the previous build
Parsing POMs
Established TCP socket on 51539
[demo] $ "C:\Program Files\Java\jdk1.7.0_80/bin/java" -cp c:\jenkins\plugins\maven-plugin\WEB-INF\lib\maven32-agent-1.7.jar;C:\work\software\apache-maven-3.3.3\boot\plexus-classworlds-2.5.2.jar;C:\work\software\apache-maven-3.3.3/conf/logging jenkins.maven3.agent.Maven32Main C:\work\software\apache-maven-3.3.3 C:\apache-tomcat-7.0.64\webapps\jenkins\WEB-INF\lib\remoting-2.52.jar c:\jenkins\plugins\maven-plugin\WEB-INF\lib\maven32-interceptor-1.7.jar c:\jenkins\plugins\maven-plugin\WEB-INF\lib\maven3-interceptor-commons-1.7.jar 51539
<===[JENKINS REMOTING CAPACITY]===>channel started
Executing Maven:  -B -f c:\jenkins\workspace\demo\pom.xml install
[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building Test001 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ Test001 ---
[WARNING] Using platform encoding (GBK actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 0 resource
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ Test001 ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ Test001 ---
[WARNING] Using platform encoding (GBK actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 0 resource
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ Test001 ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ Test001 ---
[JENKINS] Recording test results
[INFO] 
[INFO] --- maven-war-plugin:2.2:war (default-war) @ Test001 ---
[INFO] Packaging webapp
[INFO] Assembling webapp [Test001] in [c:\jenkins\workspace\demo\target\Test001-0.0.1-SNAPSHOT]
[INFO] Processing war project
[INFO] Copying webapp resources [c:\jenkins\workspace\demo\src\main\webapp]
[INFO] Webapp assembled in [41 msecs]
[INFO] Building war: c:\jenkins\workspace\demo\target\Test001-0.0.1-SNAPSHOT.war
[INFO] WEB-INF\web.xml already added, skipping
[INFO] 
[INFO] --- maven-install-plugin:2.4:install (default-install) @ Test001 ---
[INFO] Installing c:\jenkins\workspace\demo\target\Test001-0.0.1-SNAPSHOT.war to c:\wis_mvn_repo\com\xiao\Test001\0.0.1-SNAPSHOT\Test001-0.0.1-SNAPSHOT.war
[INFO] Installing c:\jenkins\workspace\demo\pom.xml to c:\wis_mvn_repo\com\xiao\Test001\0.0.1-SNAPSHOT\Test001-0.0.1-SNAPSHOT.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.192 s
[INFO] Finished at: 2015-11-10T12:59:18+08:00
[INFO] Final Memory: 17M/226M
[INFO] ------------------------------------------------------------------------
[JENKINS] Archiving c:\jenkins\workspace\demo\pom.xml to com.xiao/Test001/0.0.1-SNAPSHOT/Test001-0.0.1-SNAPSHOT.pom
[JENKINS] Archiving c:\jenkins\workspace\demo\target\Test001-0.0.1-SNAPSHOT.war to com.xiao/Test001/0.0.1-SNAPSHOT/Test001-0.0.1-SNAPSHOT.war
channel stopped
[WARNING] Couldn't clean up oid=3 from null
hudson.remoting.ChannelClosedException: channel is already closed
	at hudson.remoting.Channel.send(Channel.java:575)
	at hudson.remoting.RemoteInvocationHandler$PhantomReferenceImpl.cleanup(RemoteInvocationHandler.java:360)
	at hudson.remoting.RemoteInvocationHandler$PhantomReferenceImpl.access$700(RemoteInvocationHandler.java:319)
	at hudson.remoting.RemoteInvocationHandler$Unexporter.run(RemoteInvocationHandler.java:420)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
	at java.util.concurrent.FutureTask.run(FutureTask.java:262)
	at hudson.remoting.AtmostOneThreadExecutor$Worker.run(AtmostOneThreadExecutor.java:110)
	at java.lang.Thread.run(Thread.java:745)
Caused by: java.io.IOException
	at hudson.remoting.Channel.close(Channel.java:1160)
	at hudson.remoting.Channel.close(Channel.java:1135)
	at hudson.remoting.Channel$CloseCommand.execute(Channel.java:1076)
 
推荐文章
豪情万千的茶叶  ·  贝叶斯神经网络系列教程(二):背景知识 - 腾讯云开发者社区-腾讯云
2 年前
会开车的草稿本  ·  腾讯云开发者社区技术沙龙第29期回顾-高效智能运维(文末附PPT)-腾讯云开发者社区-腾讯云
2 年前
霸气的蚂蚁  ·  生成随机颜色 - 方帅 - 博客园
2 年前
刚分手的毛衣  ·  Section 6. 微分方程式
3 年前
今天看啥   ·   Py中国   ·   codingpro   ·   小百科   ·   link之家   ·   卧龙AI搜索
删除内容请联系邮箱 2879853325@qq.com
Code - 代码工具平台
© 2024 ~ 沪ICP备11025650号