A thousand miles kuibu, thousands of rivers. Make a little progress every day, and one day you’ll be a big shot

series

  • Jenkins Tutorial – Building (Docker version)

  • Jenkins Tutorial – Creating Maven projects

  • Jenkins Tutorial -Docker+GitLab Continuous deployment continuous integration

  • Jenkins Tutorial – Integrating SonarQube

preparation

This tutorial is integrated with GitLab, so the GitLab repository is required. Note: Your Jenkins address must be accessible to Gitlab if you want to automate deployment later. If gitLab picks up on the incident, we won’t be able to notify Jenkins;

The environment

  • Centos 7
  • Jenkins (Docker version)

The required plug-in

In addition to the plugins you installed when building Jenkins, you also need to install plugins

  • Maven Integration

Install Maven

Click Manage Jenkins in the sidebar and then Global Tool Configuration to go to Global Tool Settings

Jenkins interface

Then go to Maven and click Add Maven to select the version of Maven you want and set a name. Click save

Jenkins interface


Jenkins interface

Create Git login credentials

Click on the credentials in the sidebar and then click on the image

Jenkins interface


Jenkins interface


Jenkins interface


Jenkins interface

There are a lot of options for Kind here, so here I’m going to go to Username with password, and I’m going to set it with the account password; Then enter the gitlab account and Password in the Username and Password input boxes, respectively. Click OK to save;

Jenkins interface


Jenkins interface

After saving, you will appear to save the credentials;

Create a JOB

Jenkins interface

Creating a Maven project

Jenkins interface

Enter your GitLab project address and select the credentials you just configured

Jenkins interface

Enter the Maven packaging command and click Save

Jenkins interface

Begin to build

Jenkins interface

View the build project log

The first build will be slower because he has to download the maven-related build package

Jenkins interface


Jenkins interface


Jenkins interface

View the built JAR package

Jenkins interface


Jenkins interface


Jenkins interface


Jenkins interface

At this point, you are finished building the Maven project and can download the JAR package for deployment. A tutorial on automatic build deployment will follow