有一些Maven项目。我想将其更改为jenkins中的脚本管道
答案 0 :(得分:0)
要使以下示例自动化,您可以通过groovy脚本控制台或groovy系统脚本使用Jenkins API,以编程方式创建作业。
脚本管道示例:
node{
stage ('Build') {
git url: 'https://github.com/cyrille-leclerc/multi-module-maven-project'
withMaven(
// Maven installation declared in the Jenkins "Global Tool Configuration"
maven: 'M3',
// Maven settings.xml file defined with the Jenkins Config File Provider Plugin
// Maven settings and global settings can also be defined in Jenkins Global Tools Configuration
mavenSettingsConfig: 'my-maven-settings',
mavenLocalRepo: '.repository') {
// Run the maven build
sh "mvn clean install"
} // withMaven will discover the generated Maven artifacts, JUnit Surefire & FailSafe & FindBugs reports...
}
}
您需要管道Maven插件:https://wiki.jenkins.io/display/JENKINS/Pipeline+Maven+Plugin