Jenkins detailed installation and build deployment using tutorials

Source: Internet
Author: User

Jenkins is an open source software project designed to provide an open and easy-to-use software platform that makes continuous software integration possible. Jenkins is a continuous integration tool based on Java development that monitors ongoing duplication of work, including:
1. Continuous software release/test project.
2. Monitor the work performed by external calls.

The Linux:ubuntu used in this article

Where JDK, Tomcat, SVN server see here Ubuntu installation configuration jdk, Tomcat, SVN server

First, install Jenkins

This article installs directly using the war package

: https://jenkins-ci.org/content/thank-you-downloading-windows-installer/


There are two ways to install a war pack

Method One

Download Jenkins.war, copy to D:\Java\Tool\jenkins (), and then run Java-jar Jenkins.war. (Note that you need to install the JDK first, then set the JAVA_HOME environment variable and add%java_home%\bin to the PATH environment variable)

Run as follows:

To access http://localhost:8080, the main interface of Jenkins is as follows:


Method Two

The Jenkins 1.409.1 version of the extract, the resulting war package is thrown directly under Tomcat, start tomcat,jenkins installed, access to http://localhost:8080


Ii. Building a maven project

1. Create a new job


2. Enter a name and project type


3, set the compiled version number and other information

4. Set the SVN repository address:

Enter the address of the project hosting SVN, and if there is a place to enter your account and password, enter it.


The user or password is incorrect if any of the following appear:

Click in to reset the user and password

5. Configuring JDK and Maven

The first open appears as follows, click to enter. Require prompts to set up JDK and Maven


Click System Management-system settings to find the location of JDK and MAVEN settings

Select this computer's:


9. It is possible to construct this project here.

Click Build


Build the output information:


The build success output is as follows:


10. Verification

At this point it has automatically packaged the project into a war package, which is packaged by default to C:\Users\linbingwen\.jenkins\workspace\JavaWeb\JavaWeb\target



or click below:



III. automatic remote deployment to Tomcat

Next, after completing the auto-build war package, upload some war packages to the WebApps directory of the remote Linux tomcat, update the project's war package, and restart Tomcat.

1, install the plug-in

System Management-"management plug-in, the optional plug-in to find the following, and then click the Direct Installation command, after successful installation to restart Jenkins


The author is wrong in installing the plugin times as follows:



This should be the wall of the celestial cause, so I used the manual installation of the way.

Workaround:

Manual Installation

To Https://wiki.jenkins-ci.org/display/JENKINS/Publish+Over+SSH+Plugin, download HPI to local computer to


In System Management--management plugin--Advanced--Browse-upload plugin can


Then it automatically uploads and installs:

The red is the author of the online installation is unsuccessful, the blue is the author of the successful installation, and then restart Jenkis.


2, configure the SSH content: in the System Management-"system Setup to find publish over SSH
Then enter:

3. Configure Post Steps
Here is still the above Javaweb project, this configuration to install the above plugin will not be displayed!

which
Transfer SetSource files: Represents the local war package and path to be uploaded to the workspace to see
Remove prefix: Represents the folder to be removed when uploading, that is, only the war package is uploaded
Remote driectory: That means the path of execution, which is equivalent to uploading the war package here.
EXEC commad: the command to execute
The contents of the script to be executed:
#!/bin/sh#defined tomcat_home= "/usr/java/tomcat/apache-tomcat-7.0.67/" id= ' Ps-ef | grep java | grep Tomcat|awk ' {print $} ' echo $ID echo "Kill Tomcat" Kill-9 $IDecho "Remover War file" CD "$TOMCAT _home"/webappsrm-rf JAVAWEB-0.0.1-SNAPSHOTRM-RF javaweb-0.0.1-snapshot.warecho "Copy War to WebApp" CD/HOME/LINCP Javaweb-0.0.1-snapshot.war "$TOMCAT _home"/WEBAPPSCD "$TOMCAT _home"/binecho "Start TOMCAT"./startup.sh
Step: First stop tomcat delete WebApp under the corresponding war package copy war to WebApps restart Tomcat


4, build the deployment click the Project Build button, and finally appear as follows:

Open the browser on Linux and enter http://localhost:8080/JavaWeb-0.0.1-SNAPSHOT/

Note: The SSH user configured here: Lin to have root permissions, or can be an error does not have permission to execute the kill or RM command

The linux:ubuntu14.04 used in this article

Where JDK, Tomcat, SVN server see here Ubuntu installation configuration jdk, Tomcat, SVN server



Jenkins detailed installation and build deployment using tutorials

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.