标签:
上接:Jenkins+maven+svn+tomcat操作手册(二)
部署完成之后,我们来进行测试
注意:在构建之前要启动tomcat,因为jenkins需要通过网络访问tomcat,然后把war文件自动部署到tomcat的webapps目录下。
下面开始构建,可以等着自动去build,也可以手工去触发一次,手工触发如下图所示的操作:
构建完成之后,点击Name下边的连接:
然后点击Console Output可以查看控制台输出的日志,查看报错的原因:
通过错误原因,我们可以知道, 无法访问tomcat,因为我们访问tomcat的时候,需要用户名和密码,因此我们需要对tomcat进行配置才能访问:
在tomcat-users.xml的最后添加如下信息:
<role rolename="manager"/>
<role rolename="manager-gui"/>
<role rolename="manager-script"/>
<role rolename="admin"/>
<user username="tomcat" password="tomcat" roles="admin,manager,manager-script,manager-gui"/>
然后重新启动tomcat:
等待着jenkins再次重新部署:
如果看到蓝色的,说明部署成功,通过每次部署的时间,我们可以知道确实已经自动开始部署,而且是每隔3分钟部署一次:
Tomcat控制台的信息如下:
成功部署之后Console Output的日志如下所示:
Started by user 燕鲲鹏
Building in workspace D:\Program Files (x86)\Jenkins\workspace\springtest
Updating http://test.ykp.com:9999/svn/ykp/springtest/branches/springtest at revision ‘2016-04-28T13:32:57.702 +0800‘
At revision 11
no change for http://test.ykp.com:9999/svn/ykp/springtest/branches/springtest since the previous build
Parsing POMs
[springtest] $ "D:\Program Files\Java\jdk1.7.0_45/bin/java" -cp "D:\Program Files (x86)\Jenkins\plugins\maven-plugin\WEB-INF\lib\maven31-agent-1.5.jar;D:\apache-maven-3.2.1\boot\plexus-classworlds-2.5.1.jar;D:\apache-maven-3.2.1/conf/logging" jenkins.maven3.agent.Maven31Main D:\apache-maven-3.2.1 "D:\Program Files (x86)\Jenkins\war\WEB-INF\lib\remoting-2.53.3.jar" "D:\Program Files (x86)\Jenkins\plugins\maven-plugin\WEB-INF\lib\maven31-interceptor-1.5.jar" "D:\Program Files (x86)\Jenkins\plugins\maven-plugin\WEB-INF\lib\maven3-interceptor-commons-1.5.jar" 22990
<===[JENKINS REMOTING CAPACITY]===>channel started
Executing Maven: -B -f D:\Program Files (x86)\Jenkins\workspace\springtest\pom.xml install
[INFO] Scanning for projects...
[INFO]
[INFO] Using the builder org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder with a thread count of 1
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building springtest 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ springtest ---
[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.2:compile (default-compile) @ springtest ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ springtest ---
[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.2:testCompile (default-testCompile) @ springtest ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ springtest ---
[JENKINS] Recording test results
[INFO]
[INFO] --- maven-war-plugin:2.1.1:war (default-war) @ springtest ---
[INFO] Packaging webapp
[INFO] Assembling webapp [springtest] in [D:\Program Files (x86)\Jenkins\workspace\springtest\target\springtest-0.0.1-SNAPSHOT]
[INFO] Processing war project
[INFO] Copying webapp webResources [D:\Program Files (x86)\Jenkins\workspace\springtest\webapp] to [D:\Program Files (x86)\Jenkins\workspace\springtest\target\springtest-0.0.1-SNAPSHOT]
[INFO] Copying webapp resources [D:\Program Files (x86)\Jenkins\workspace\springtest\src\main\webapp]
[INFO] Webapp assembled in [232 msecs]
[INFO] Building war: D:\Program Files (x86)\Jenkins\workspace\springtest\target\springtest-0.0.1-SNAPSHOT.war
[WARNING] Warning: selected war files include a WEB-INF/web.xml which will be ignored
(webxml attribute is missing from war task, or ignoreWebxml attribute is specified as ‘true‘)
[INFO]
[INFO] --- maven-install-plugin:2.4:install (default-install) @ springtest ---
[INFO] Installing D:\Program Files (x86)\Jenkins\workspace\springtest\target\springtest-0.0.1-SNAPSHOT.war to D:\m2\repository\com\ykp\springtest\0.0.1-SNAPSHOT\springtest-0.0.1-SNAPSHOT.war
[INFO] Installing D:\Program Files (x86)\Jenkins\workspace\springtest\pom.xml to D:\m2\repository\com\ykp\springtest\0.0.1-SNAPSHOT\springtest-0.0.1-SNAPSHOT.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.663 s
[INFO] Finished at: 2016-04-28T13:33:04+08:00
[INFO] Final Memory: 17M/225M
[INFO] ------------------------------------------------------------------------
Waiting for Jenkins to finish collecting data
[JENKINS] Archiving D:\Program Files (x86)\Jenkins\workspace\springtest\pom.xml to com.ykp/springtest/0.0.1-SNAPSHOT/springtest-0.0.1-SNAPSHOT.pom
[JENKINS] Archiving D:\Program Files (x86)\Jenkins\workspace\springtest\target\springtest-0.0.1-SNAPSHOT.war to com.ykp/springtest/0.0.1-SNAPSHOT/springtest-0.0.1-SNAPSHOT.war
channel stopped
Deploying D:\Program Files (x86)\Jenkins\workspace\springtest\target\springtest-0.0.1-SNAPSHOT.war to container Tomcat 7.x Remote
[D:\Program Files (x86)\Jenkins\workspace\springtest\target\springtest-0.0.1-SNAPSHOT.war] is not deployed. Doing a fresh deployment.
Deploying [D:\Program Files (x86)\Jenkins\workspace\springtest\target\springtest-0.0.1-SNAPSHOT.war]
Finished: SUCCESS
这是整个部署的控制台日志,如果最后看到Deploying,并且Finished: SUCCESS的话,我们就可判定自动部署成功。
我们查看tomcat的webapps目录可以看到war文件确实已经存在:
最后,我们通过浏览器进行验证:
至此,jenkins的自动部署已经全部安装部署测试完毕,接下来我们来进行一个总结:Jenkins+maven+svn+tomcat操作手册(四)
Jenkins+maven+svn+tomcat操作手册(三)
标签:
原文地址:http://blog.csdn.net/ghgzczxcvxv/article/details/51297330