Jenkins (VII)---Jenkins Project compilation test publish a Web project built by Maven

Source: Internet
Author: User
Tags quic

/**

* Lihaibo

* The content of the article is based on the practice of their own work.

* No reprint without the consent of the author

*/

First, using MAVEN to compile

(Maven compilation is similar to testing test and packaged package and deployment install, no more)

There is a MAVEN configuration on the project's configuration page: There is only one clean in it that clears the previous build information:

I used the clean package to compile packaging: results such as:

--------------------------------------------------------

When only clean is executed, the previously constructed information is deleted:

------------------------------------------------------

Attached NOTE:

/opt/jenkins_tomcat6/jobs/quick4j_demo/workspace/target/opt/jenkins_tomcat6     says Jenkins working directory jobs /Quick4j_demo        indicates that Jenkins manages the directory of Quick4j_demo projects workspace                The working directory of plugins such as Maven

-------------------------------------------------------

Second, in Tomcat deployed to the remote host

Focus: Two machines to ssh remote root login without password.

Go back to Jenkins (ii)---the global picture in Jenkins ' Git+maven+jdk+tomcat:

Server A---> Jenkins host ip:192.168.100.119

Server B---> Remote deployment host ip:192.168.100.118

Here is the compilation process log

Purple font :Jenkins uses git to pull a replacement code from the Gitlab warehouse Http://192.168.100.200/clq/quick4j.git

Black font: Jenkins uses MAVEN compilation test to publish Web project to local /opt/jenkins_tomcat6/jobs/quick4j_demo/workspace/target/quick4j.war

Red font: Jenkins remotely executes the script on the remote server and transmits the built-in Web project to the remote server's specified directory/opt/jenkins, removing the original Web project package from Tomcat, and then from/opt/jenkins

Copy the newly packaged Web project war package into Tomcat and start Tomcat.

Started by user adminbuildinginchworkspace/opt/jenkins_tomcat6/jobs/quick4j_demo/Workspace #jenkins本机的工作目录>/usr/bin/git rev-parse--is-inside-work-tree # timeout=Ten fetching changes from the remote Git repository >/usr/bin/git config remote.origin.url http://192.168.100.200/clq/quick4j.git # timeout=10fetching Upstream Changes from Http://192.168.100.200/clq/quick4j.git >/usr/bin/git--version # timeout=10using. Gitcredentials to set Credentials >/usr/bin/git config--local credential.username clq # timeout=10 >/usr/bin/git config--local credent Ial.helper Store--file=/opt/tomcat6/apache-tomcat-6.0.45/temp/git4880643529884290174.credentials # timeout=10 > /usr/bin/git-c core.askpass=true fetch--tags--progress http://192.168.100.200/clq/quick4j.git +refs/heads/*:refs/ remotes/origin/* >/usr/bin/git config--local--remove-section credential # timeout=10 >/usr/bin/git rev-parse ref S/remotes/origin/master^{commit} # timeout=10 >/usr/bin/git rev-parse refs/remotes/origin/origin/master^{commit} # timeout=10checking out Revision b123b099e8e72d7e467ab780ae28726a1c866797 (refs/remotes/origin/master) >/usr/bin /git Config Core.sparsecheckout # timeout=10 >/usr/biN/git checkout-f b123b099e8e72d7e467ab780ae28726a1c866797 >/usr/bin/git rev-list b123b099e8e72d7e467ab780ae28726a1c866797 # timeout=10[Workspa CE] $/opt/apache-maven-3.3.9/bin/mvn-dmaven.repo.local=/opt/jenkins_tomcat6/jobs/quick4j_demo/workspace/. Repository Clean[info] Scanning forprojects ... [INFO] [INFO] ------------------------------------------------------------------------[INFO] Building quick4j App 1.0.0[info]--- ---------------------------------------------------------------------[INFO] [INFO]---maven-clean-plugin:2.5: Clean (default-clean) @ quick4j---[INFO] deleting/opt/jenkins_tomcat6/jobs/quick4j_demo/workspace/target[info]---- --------------------------------------------------------------------[INFO] BUILD Success[info]------------------ ------------------------------------------------------[INFO] Total time:0.299 s[info] finished at:2016-03-29t13 : 18:06+08:00[info] Final Memory:7m/238m[info]------------------------------------------------------------------- -----[Workspace] $/bin/sh-xe/opt/tomcat6/apache-tomcat-6.0.45/temp/hudson1223364716445353332.shparsing POMs[ Workspace] $/opt/jdk/bin/java-cp/opt/jenkins_tomcat6/plugins/maven-plugin/web-inf/lib/maven31-agent-1.5.jar:/ opt/apache-maven-3.3.9
/boot/plexus-classworlds-2.5.2.jar:/opt/apache-maven-3.3.9/conf/logging Jenkins.maven3.agent.Maven31Main
/opt/apache-maven-3.3.9/opt/tomcat6/apache-tomcat-6.0.45/webapps/jenkins/web-inf/lib/remoting-2.51.jar
/opt/jenkins_tomcat6/plugins/maven-plugin/web-inf/lib/maven31-interceptor-1.5.jar
/opt/jenkins_tomcat6/plugins/maven-plugin/web-inf/lib/maven3-interceptor-commons-1.5.jar 36966<===[JENKINS REMOTING capacity]===>channel startedexecuting Maven:-b-f/opt/jenkins_tomcat6/jobs/quick4j_demo/workspace/ Pom.xml
-DMAVEN.REPO.LOCAL=/OPT/JENKINS_TOMCAT6/MAVEN-REPOSITORIES/1-s/opt/apache-maven-3.3.9/conf/settings.xml
-gs/opt/apache-maven-3.3.9/conf/settings.xml clean Package[info] scanning for projects ... [INFO] [INFO]------------------------------------------------------------------------[INFO] Building quick4j App 1.0.0[ INFO]------------------------------------------------------------------------[INFO] [INFO]---maven-clean-plugin : 2.5:clean (Default-clean) @ quick4j---[info] [INFO]---maven-resources-plugin:2.6:resources (default-resources) @ QUICK4J---[INFO] Using ' UTF-8 ' encoding to copy filtered resources. [INFO] Copying 9 Resources[info] Copying 3 resources[info] [INFO]---maven-compiler-plugin:3.1:compile (default-compile) @ Quic K4J---[INFO] changes detected-recompiling the module! [INFO] Compiling, source files To/opt/jenkins_tomcat6/jobs/quick4j_demo/workspace/target/classes[info] [INFO]--- Maven-resources-plugin:2.6:testresources (default-testresources) @ quick4j---[INFO] Using ' UTF-8 ' encoding to copy filtered Resources. [INFO] Copying 3 Resources[info] [INFO]---maven-compiler-plugin:3.1:testcompile (default-testcompile) @ quick4j---[info] Changes detected-recompiling the module! [INFO] Compiling 5 source files To/opt/jenkins_tomcat6/jobs/quick4j_demo/workspace/target/test-classes[info] [INFO]--- Maven-surefire-plugin:2.18.1:test (default-test) @ quick4j---[INFO] Tests is skipped. [INFO] [INFO]---maven-war-plugin:2.2:war (default-war) @ quick4j---[info] packaging Webapp[info] Assembling WebApp [quick4j] I n [/opt/jenkins_tomcat6/jobs/quick4j_demo/workspace/target/quick4j][info] processing war Project[INFO] Copying WebApp resources [/opt/jenkins_tomcat6/jobs/quick4j_demo/workspace/src/main/webapp][info] WebApp assembled in [383 Msecs][info] Building War:/opt/jenkins_tomcat6/jobs/quick4j_demo/workspace/target/quick4j.war #发布构建好的web工程到本 Machine working directory [INFO] Web-inf/web.xml already added, Skipping[info]-------------------------------------------------------- ----------------[Info] BUILD Success[info]------------------------------------------------------------------------[INFO] Total time : 6.611 S[info] finished At:2016-03-29t13:18:15+08:00[info] Final memory:28m/ 438M[INFO]------------------------------------------------------------------------[jenkins "Archiving/opt/jenkins_tomcat6/jobs/quick4j_demo/workspace/pom.xml to Com.eliteams/quick4j/1.0.0/quick4j-1.0.0.pom[jenkins] Archiving/opt/jenkins_tomcat6/jobs/quick4j_demo/workspace /target/quick4j.war to com.eliteams/quick4j/1.0.0/quick4j-1.0.0.warssh:connecting from host [Local-Machine-1]SSH: Connecting with configuration [192.168.100.118-SSH] ... Ssh:creating Session:username [Root], hostname [192.168.100.118], Port [22]ssh:connecting session ... channel Stoppedssh : Connectedssh:opening SFTP Channel ... SSH:SFTP Channel openssh:connecting SFTP channel ... SSH:CONNECTEDSSH:CD [/OPT/JENKINS]SSH:OKSSH:CD [/opt/jenkins]ssh:okssh:put [quick4j.war]ssh:okssh:opening exec Cha Nnel ... SSH:EXEC:channel openssh:exec:stdout/stderr from command [sh/opt/auto_deploy.sh] ... SSH:EXEC:connected [2016-03-29]13:18:23 *************************************updating Server Environment startupdating Server Environment Endcheck Tomcat Status...tomcat is Running....port is 9090shutdown Tomcat. ... >>>>>>>shutdown tomcat begin<<<<<<<<using CATALINA_BASE:/opt/ Tomcat6/apache-tomcat-6.0.45using catalina_home:/opt/tomcat6/apache-tomcat-6.0.45using CATALINA_TMPDIR:/opt/ Tomcat6/apache-tomcat-6.0.45/tempusing jre_home:/app/java/jdk1.8.0_11/jreusing CLASSPATH:/opt/tomcat6/apach E-tomcat-6.0.45/bin/bootstrap.jar>>>>>>>shutdown Tomcat End <<<<<<<< --------------begin transfer War package to Tomcat WebApps-------------------find/opt/jenkins exist war package Quic K4j.wardeleteing Old package Quick4j.war in/opt/tomcat6/apache-tomcat-6.0.45/webapps/start transfer Quick4j.war to/op t/tomcat6/apache-tomcat-6.0.45/webapps/--------------TransferWar package to Tomcat WebApps end------------------->>>>>>> rebooting Tomcat begin <<<& Lt;<<<<using catalina_base:/opt/tomcat6/apache-tomcat-6.0.45using CATALINA_HOME:/opt/tomcat6/ Apache-tomcat-6.0.45using catalina_tmpdir:/opt/tomcat6/apache-tomcat-6.0.45/tempusing JRE_HOME:/app/java/jdk1.8. 0_11/jreusing CLASSPATH:/opt/tomcat6/apache-tomcat-6.0.45/bin/bootstrap.jar >>>>>>> rebootin G Tomcat End <<<<<<<<the log you can read in canalina.out************************ Deploy War pack Age to Container successlly **********************************ssh:exec:completed after 11,406 msssh:disconnecting Co nfiguration [192.168.100.118-ssh] ... Ssh:transferred 1 file (s) finished:success

--------------------------------------------------------------------------------------------------------------- -----------------------------------------

Third, the browser verification is published correctly:

Jenkins host ip:192.168.100.119

Remote Deployment Host ip:192.168.100.118

Publishing success

Jenkins (VII)---Jenkins Project compilation test publish a Web project built by Maven

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.