官术网_书友最值得收藏!

Configuring Maven in the Jenkins server

Go to Manage Jenkins | Global Tool Configuration.

We have already installed Maven on our machine. So enter a name for the Maven installation and the M2_HOME path as follows:

Let's configure our Jenkins job to build our sample project:

  1. Click on create new jobs:
  1. Create a Jenkins job with the Maven plugin. Provide the job name devops-ci-cd (you can choose another project name, if you want):
  1. In the Source Code Management section, provide the Git URL of your project. Provide credentials to clone the repository in Jenkins:
  1. Choose GitHub hook trigger for GitScm polling in Build Triggers. If Jenkins receives a PUSH GitHub webhook from the preceding repository, it will trigger this job:
  1. Provide a path to root pom.xml. It will be a relative path to the module root. In Build, add Root POM as pom.xml and Goals and options as package:
  1. Save your work and click on Build now.

This will create my-app-1.0-SNAPSHOT.jar in the /var/lib/Jenkins/workspace/target folder. You can check the console logs while the project build is in progress.

Once the JAR is successfully built, you can see the console logs as shown in the following screenshot:

We have completed a continuous integration job successfully. Now, we need to add the Jenkins webhook URL in the GitHub settings to trigger a Jenkins build whenever someone pushes code to our GitHub project.

主站蜘蛛池模板: 高雄市| 三穗县| 寻甸| 余姚市| 揭阳市| 永春县| 芮城县| 彭山县| 鄱阳县| 大兴区| 吉木乃县| 日喀则市| 登封市| 宁夏| 永年县| 察隅县| 岢岚县| 凌源市| 北海市| 旬邑县| 泽库县| 东至县| 安吉县| 全南县| 慈利县| 东莞市| 天峻县| 达拉特旗| 邻水| 剑川县| 易门县| 黑水县| 清河县| 达尔| 德令哈市| 昂仁县| 梓潼县| 河东区| 靖州| 资阳市| 正阳县|