Jenkins+gitlab+mvn+tomcat for Continuous integration

Source: Internet
Author: User
Tags using git

I. BACKGROUND

Previously used Svn+jenkins, but consulting all around the colleagues, using Git, plus the leader said to change git, impulse to put git into a bit.
For more information on how to install Gitlab, please refer to another blog, blog address: http://blog.51cto.com/xinsir/2176199
For information on how to install Jenkins please refer to another blog, blog address: http://blog.51cto.com/xinsir/1969200

Second, Jenkins installation Gitlab plug-in

Click Jenkins---System Management---plug-in management


Click the Optional plugin---Enter Gitlab in the upper right corner to search---Select Gitlab---Click Install directly

Iii. How to configure the MAVEN project how to do the auto-build function A: How to implement Jenkins to automatically clone code on Gitlab

First, to create an access token on Gitlab, follow the steps below, click on User--set

Click the access token

Edit token information and set permissions

Once created, the key for the cost token will be generated, and the key will only be displayed once, and must be saved when the build is complete.

Go to Jenkins. Add the token you just created, test success, click System Settings

Click the Gitlab tab

Edit content and create users

How to create a user

Whether the test was successful

Generate a pair of SSH key public key pairs locally, then upload the public key to Gitlab above, the private key is configured on Jenkins above, the operation is as follows.
How to generate a key pair, see below
Create a new MVN project and set the source mode

Click Add after credentials to add an account.

Here is the user you just created,

All the configuration is over here.

One more thing to say is how to configure the public key generated on the Jenkins server on the Gitlab to Gitlab.
Click the user----set----SSH key

Paste the entire contents of the generated public key into the box, enter a name that you can easily see in the title, and click Add Encryption Key.

Here are some additional advanced features,

This function is used when you clone the code into a specified directory.

This function is used to specify that you check out that subdirectory, such as my Git project has a lot of sub-files, I just want to check out a directory, then write it here, but there is a problem to note, if you write a, then will be in the/root/.jenkins/workspace/ Project name/Sub-file directory/Sub-file The following code, if this is the case, then specify the pom file path below, you need to write a layer of path. Remember!!!!!!!

This function is used to define those files that are valid and those that are invalid. For example, if you do a regular rotation to build the project, but you just want to monitor several directories or file changes, then use this.

At this point, all the content is complete.

Jenkins+gitlab+mvn+tomcat for Continuous integration

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.