【发布时间】:2017-12-22 06:58:04
【问题描述】:
我正在尝试为我的 Maven 发布插件配置 SCM。但是,问题是:我的原型中的 pom.xml,我不想硬编码单个 scm 变量而是参数化版本。在我的 jenkinsfile 中,我们有一个填充 scm url 的专有工具,所以一旦我从我的原型设置项目,我想将该 url 替换到我的 pom.xml 中。请参阅下面的代码 sn-p。
<developerConnection>scm:git:${myVariable}</developerConnection>
在我的 Jenkinsfile 中,我像这样提取这个值(这工作正常):
node {
stage 'Checkout'
checkout scm
def myVariable= sh(returnStdout: true, script: 'git config remote.origin.url').trim()
所以,回顾一下,我想知道 Jenkins 的值如何被替换到 pom.xml 中?
现在,我收到此错误:
[INFO] fetch url: ${myVariable}
[INFO] push url: ${myVariable}
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.755 s
[INFO] Finished at: 2017-07-17T16:21:00+00:00
[INFO] Final Memory: 20M/784M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.5.3:prepare (default-cli) on project newSeedService: An error is occurred in the checkin process: Exception while executing SCM command. JGit checkin failure! ${myVariable}: not found. -> [Help 1]
谢谢
【问题讨论】: