我的Jenkins管道脚本中有以下代码:
sh("alias git='/my/file/path/libexec/git-core/git'")
mvn "-e -X release:prepare"第二行调用git,它失败了,错误代码为:
The git-tag command failed.
Command output:
/bin/sh: git: command not found
Caused by: org.apache.maven.plugin.MojoFailureException: Unable to tag SCM这不应该发生,因为我先给它起了别名。
我怀疑这些语句是在不同的shell中运行的。
这是真的吗?在这种情况下,我如何防止这种情况?
发布于 2017-03-07 02:34:51
不确定你的脚本中的mvn是什么(管道中没有内置的Maven函数),但我认为你想要这样的东西:
sh '''
export PATH=$PATH:/my/file/path/libexec/git-core/git
mvn -e -X release:prepare
'''https://stackoverflow.com/questions/42624863
复制相似问题