Jenkins is an extensible, continuous integration engine that Jenkins is easy to install and configure, easy to use, and see how we can quickly build a continuous integration environment in minutes.
Suppose we currently have 2 Maven projects: Entities (Java Class Library), Web (Web application, dependency entities).
First, install Jenkins
Address http://mirrors.jenkins-ci.org/Download the appropriate Jenkins version.
The Jenkins address for the latest stable version of Windows is:http://mirrors.jenkins-ci.org/windows-stable/jenkins-1.409.1.zip
Https://wiki.jenkins-ci.org/display/JENKINS/Installing+Jenkins+as+a+Windows+service
The Jenkins 1.409.1 version of the decompression, the resulting war package is thrown directly under Tomcat, start Tomcat,jenkins installation is complete, is not very simple AH.
Redhat system Installation Process: Https://wiki.jenkins-ci.org/display/JENKINS/Installing+Jenkins+on+Red+Hat+distributions
Second, configure Jenkins
1, open http://10.3.15.78:8080/jenkins/, the first time into the inside no data, we need to create a job, we have 2 projects, we need to create 2 jobs. http://10.3.34.163:9890/jenkins/
2, click on the new job in the upper left corner, the new job page needs to select the type of job, Jenkins supports several types, we choose "Build a MAVEN2/3 project", the job name is: guan_caijing,:
3, click the OK button, enter into the detailed configuration interface, detailed configuration of the interface a lot of configuration, but do not fear, most of the use of the default configuration can be, the following say we need to modify several places:
3.1) Source Code Management
Because we use SVN to manage the source code, here we choose Subversion and enter our SVN address in the repository URL:
http://10.3.34.163:9880/guan_caijing/trunk/
After entering the URL address of the SVN library, Jenkins automatically validates the address and gives hints.
Click the Enter credential link in the Red Font section to enter the following page:
After setting up a username and password to access the SVN library, click the OK button to display:
Description the setting was successful. Click the Close button to return to the previous source Code management page. There are no more red warning messages at this time.
3.2) Configure the automatic build plan, assuming that we want to build the project automatically once every day at 12 and 8 o'clock, just select build periodicallyin build triggersand schedule Enter 0 12,20 ** *.
I configured 8 per night. Point Auto-Build
Note: Schedule the configuration rules are 5 characters separated by spaces, representing from left to right: minutes when days Month years. * on behalf of all, 0 12,20 * * * means " 0 points" at any day of the year , any month, at any of the years .
3.3) Configure here, someone may find a red error message in the build configuration node, prompting
Jenkins needs to know where your Maven2 is installed.
The system configuration.
:
This is because Jenkins could not find the reason for MAVEN, click "System Configuration", the MAVEN configuration in the system configuration to add the directory is OK, such as:
I set up the installation directory for JRE 6 and Maven 3.
Click the Save button in the lower left corner to save your settings.
3.4) After all the configuration is saved, our 1th job is completed.
3.5) Create a 2nd job with the same configuration as above. Just change the SVN address to:Http://localhost/svn/Web
Third, manual construction
After the above configuration, go back to the Jenkins home page, you can see the 2 jobs just added, such as:
Click on the "Schedule a Build" image after clicking on a 1 job to manually build, click Finish, will be on the left of the build queue or build Executor Status display the task being built, after the automatic build, refresh the page, You can see the build results, how to build a project failed, click on the building number behind the project (starting from 1) to enter the project's "Console Output" To see why the project build failed. Of course we can also configure the results of the build failure to be sent to the mailbox.
So far, 1 simple auto-build environments have been set up, very simple.
Iv. Automatic Deployment
After reading the above found that the Jenkins configuration is really simple, a few minutes to build an automatic building environment, but the environment was set up to find 1 problems, now it can be automatically built, But the built-in Web.war are still in the Jenkins directory, not published in Tomcat, but also manually copy the past?
This is a problem, but don't worry, to achieve the purpose of automatic deployment, you need to install 1 Jenkins deployment plug-ins. Select Manage plugins on the System administration menu:
Select "Optional Plugin" to locate the deploy Plugin 1.8 plugin and select it.
Note: The Deploy Plugin 1.8 plugin supports Tomcat 4.x/5.x/6.x/7.x, JBoss 3.x/4.x, Glassfish 2.x/3.x
Click on the "Install" button at the bottom to display:
Wait patiently:
Until deploy plugin is complete, show success:
Select the box to tick and Jenkins will restart automatically:
At this point, on the Installed tab of the plug-in management, you can see that the deployment plug-in has been installed.
Re-enter the Web configure configuration interface, at the bottom of the discovery of more than 1 configuration items, we configured as follows:
Note: The war file uses a relative directory of Jenkinsworkspace, and the default directory for Hudon is:
C:\Documents and Settings\ user name \. Jenkins\
Workspace directory: C:\Documents and Settings\ user name \. Jenkins\ jobs\web\workspace\
The resulting war is in: C:\Documents and Settings\ user name \. Jenkins\ Jobs\web\workspace\web\target\web.war
Save the configuration and rebuild it again, open the Tomcat WebApps directory and discover that Web.war is finally here and done.
JENKINS+MAVEN+SVN Fast Build continuous Integration environment (RPM)