Lao Li share: Continuous integration Learn Jenkins's git and maven configuration
For Jenkins terminology, please refer to the following connection:
Https://wiki.jenkins-ci.org/display/JENKINS/Terminology
1. Add git plugin via the Jenkins Web page
Manage jenkins->manage plugins->available Select the git plugin installation,
Note to fill in the user name and email address, or you will encounter git tag error later
The public key required to create a git user on a 2.Jenkins server
Refer to the GIT server article for specific steps
http://blog.csdn.net/sheismylife/article/details/7204345
Note that the public and private key files in the last generated. SSH directory will be copied to the/var/lib/jenkins/.ssh directory, otherwise the git clone command will error
3. Modify the Jenkins directory permissions
Chmod-r 777/var/lib/jenkins
4. Create a project test from a Web page and set the project to use Git as version management.
and set the repository path, for example: [Email protected]:cml.git
5. Specify the Pom.xml path you need to perform in the Pom file of the build option
For example, a test project called client, is a MAVEN project, set to Client/pom.xml
6. You can now test by clicking on the left-hand build
All OK, there is no error log. You can see the test results in build history with no errors.
7.Email Send Settings
In manage Jenkins->configure system->email notification, set the basic information sent by SMTP, click Advanced, you can fill in the user name and password. There is also a test button that can be used to send the test settings correctly.
At the same time in the test project building settings check the e-mail Notification, click on the right question mark, the Help document will appear in four cases will send an email, fill in the email address, Then deliberately modify the client code to not compile through. Then click the Build Now button to test it. Sure enough to receive an email.
8. Check code updates and compile
You can set the timer check compile function by poll SCM.
For example, */5 * * * * is checked every 5 minutes, if there is an update in the Git repository, the build operation is performed.
9. Speed up download with maven
See: http://blog.csdn.net/sheismylife/article/details/7209722
Jenkins '. M2 directory path in:/var/lib/jenkins/.m2/
Clear all Jar packages First, then create the settings.xml file and edit the following:
<settings>
<mirrors>
<mirror>
<!--this sends everything else to/public-
<id>nexus</id>
<mirrorOf>*</mirrorOf>
<url>http://S1:8081/nexus/content/groups/public</url>
</mirror>
</mirrors>
<profiles>
<profile>
<id>nexus</id>
<!--Enable snapshots for the built on central repo to direct-to-
<!--all requests to nexus via the mirror--
<repositories>
<repository>
<id>central</id>
<url>http://central</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>central</id>
<url>http://central</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
<activeProfiles>
<!--make the profiles active all the time-
<activeProfile>nexus</activeProfile>
</activeProfiles>
</settings>
Now click on Build to test, open console output, see the command line output, if you find the jar package downloaded from S1, it is correct. Compared with the use of a few, save more than 1 minutes.
The original link; http://www.cnblogs.com/laoli0201
Lao Li share: Continuous integration Learn Jenkins's git and maven configuration