1.jenkins pipline:一些列jenkins插件将整个CD(持续交付过程)用解释性代码Jenkinsfile来描述(之前的都是通过配置设置的,这次是通过file)
2.创建一个流水线任务
3.再global tool configuration里添加一个maven,名字叫M3,官方的名字
4.script讲解
# stage就是一个步骤,stage中的参数,类似于注释
# 通过git来获取代码
#
node { def mvnHome stage(‘Preparation‘) { // for display purposes // Get some code from a GitHub repository git ‘https://github.com/jglick/simple-maven-project-with-tests.git‘ // Get the Maven tool. // ** NOTE: This ‘M3‘ Maven tool must be configured // ** in the global configuration. mvnHome = tool ‘M3‘ } stage(‘Build‘) { // Run the maven build withEnv(["MVN_HOME=$mvnHome"]) { if (isUnix()) { sh ‘"$MVN_HOME/bin/mvn" -Dmaven.test.failure.ignore clean package‘ } else { bat(/"%MVN_HOME%\bin\mvn" -Dmaven.test.failure.ignore clean package/) } } } stage(‘Results‘) { junit ‘**/target/surefire-reports/TEST-*.xml‘ archiveArtifacts ‘target/*.jar‘ } }
5.安装BlueOcean
6.持续集成接口项目
>
原文:https://www.cnblogs.com/n-n5980/p/12183336.html