要使用maven开发Jenkins插件,必须在pom.xml
中定义我依赖的库的版本。
如何找出要使用的版本?除了冗长的尝试和错误会话以外,还有什么可以找到maven接受的组合吗?
我用
生成了一个插件框架mvn archetype:generate -Dfilter=io.jenkins.archetypes:empty-plugin
我得到了针对Jenkins 2.7.3的基本pom,对我来说很好。
我安装了Jenkins 2.7.3,并让其下载插件以完成安装。
现在,我检查Jenkins选择的其插件的版本,并将其输入到我的POM中:
org.jenkins-ci.plugins.workflow:workflow-job: 2.12.2
org.jenkins-ci.plugins.workflow:workflow-scm-step: 2.6
org.jenkins-ci.plugins.workflow:workflow-cps: 2.45
org.jenkins-ci.plugins.workflow:workflow-api: 2.27
org.jenkins-ci.plugins.workflow:workflow-support: 2.18
org.jenkins-ci.plugins:scm-api: 2.2.7
(可读性的简化语法)
尝试构建它,maven失败并显示:
Rule 6: org.apache.maven.plugins.enforcer.RequireUpperBoundDeps failed with message:
Failed while enforcing RequireUpperBoundDeps. The error(s) are [
Require upper bound dependencies error for org.jenkins-ci.plugins.workflow:workflow-step-api:2.10 paths to dependency are:
+-io.jenkins.plugins:Devgate:1.0-SNAPSHOT
+-org.jenkins-ci.plugins.workflow:workflow-job:2.12.2
+-org.jenkins-ci.plugins.workflow:workflow-step-api:2.10
and
+-io.jenkins.plugins:Devgate:1.0-SNAPSHOT
+-org.jenkins-ci.plugins.workflow:workflow-scm-step:2.6
+-org.jenkins-ci.plugins.workflow:workflow-step-api:2.9
and
+-io.jenkins.plugins:Devgate:1.0-SNAPSHOT
+-org.jenkins-ci.plugins.workflow:workflow-cps:2.45
+-org.jenkins-ci.plugins.workflow:workflow-step-api:2.13
and
+-io.jenkins.plugins:Devgate:1.0-SNAPSHOT
+-org.jenkins-ci.plugins.workflow:workflow-api:2.27
+-org.jenkins-ci.plugins.workflow:workflow-step-api:2.10
and
+-io.jenkins.plugins:Devgate:1.0-SNAPSHOT
+-org.jenkins-ci.plugins.workflow:workflow-support:2.18
+-org.jenkins-ci.plugins.workflow:workflow-step-api:2.13
]
我该如何解决?在哪里可以获得可以共存的一组依赖版本?