[英]Jenkins Multibranch project are not triggered when a SNAPSHOT is built
I have in Jenkins (v2.164.3) different maven projects, which reside in our local gitlab server. 我在Jenkins(v2.164.3)中有不同的Maven项目,它们位于我们的本地gitlab服务器中。
All projects define the following Jenkinsfile
: 所有项目都定义以下Jenkinsfile
:
node {
stage('git') {
checkout scm
}
stage('compile') {
withMaven(mavenSettingsConfig: 'e228f408-7768-4374-b8e1-259321e2fa99') {
bat "mvn clean compile"
}
}
stage('test') {
withMaven(mavenSettingsConfig: 'e228f408-7768-4374-b8e1-259321e2fa99') {
bat "mvn test"
}
}
stage('install') {
withMaven(mavenSettingsConfig: 'e228f408-7768-4374-b8e1-259321e2fa99') {
bat "mvn install -DskipTests"
}
}
}
in the configuration of the multibranch project, the option Build whenever a SNAPSHOT dependency is built
is checked. 在多分支项目的配置中,选中了每Build whenever a SNAPSHOT dependency is built
项时就Build whenever a SNAPSHOT dependency is built
的选项。 (The same option in the configuration of the several branches is not checked) (未选中多个分支的配置中的相同选项)
Unfortunately this check seems to be ignored in my case, as when a project (projectX) is build (eg the develop branch, that creates a SNAPSHOT jar), all downstream projects (withe their develop branch), that define a dependency in their pom to projectX, are not triggered. 不幸的是,在我的情况下,这种检查似乎被忽略了,因为在构建项目(projectX)(例如,创建SNAPSHOT jar的developer分支)时,所有下游项目(及其develop分支)都在其pom中定义了依赖项到projectX,不会被触发。
What is wrong ? 怎么了 ? Or do I need to check the option in all branches of the multibranch project ? 还是我需要在多分支项目的所有分支中检查该选项? Or do I need to change something in my Jenkinsfile
? 还是我需要更改Jenkinsfile
?
Thanks 谢谢
Please see the Pipeline Maven Plugin FAQ > My downstream pipelines don't get triggered even if I use "Build whenever a SNAPSHOT dependency is built" 请参阅Pipeline Maven插件常见问题解答>即使我使用“每当构建SNAPSHOT依赖项时都进行构建”,也不会触发我的下游管道
To configure the Jenkins Pipeline Maven integration to trigger downstream pipelines on "mvn install": 要配置Jenkins Pipeline Maven集成以在“ mvn install”上触发下游管道:
Either change the global configuration: 更改全局配置:
Or in the script of the upstream pipeline, configure withMaven(options: [pipelineGraphPublisher(lifecycleThreshold: 'install')]) {...}
或在上游管道的脚本中,配置withMaven(options: [pipelineGraphPublisher(lifecycleThreshold: 'install')]) {...}
Note: regarding your declaration mavenSettingsConfig: 'e228f408-...'
, please note that you can declare the Maven settings either globally or at the folder level as documented on Jenkins Pipeline Maven Integration > Features > Maven Settings 注意:关于声明mavenSettingsConfig: 'e228f408-...'
,请注意,您可以全局声明或在文件夹级别声明Maven设置,如Jenkins Pipeline Maven集成>功能> Maven设置中所述。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.