尝试在 Jenkins DSL mavenJob 的 preBuildSteps 中执行 shell() 命令



我做了很多调查,试图找到在mavenJob的preBuildSteps中运行shell((脚本命令的示例。我所找到的只是简单的例子。例如:

mavenJob('example-1') {
    preBuildSteps {
        shell("echo 'run before Maven'")
    }
}

我想执行一个 linux bash 脚本。 例如:

shell("bash/scripts/pom.xml.exists.sh"(

执行时,我收到以下错误消息:

  • bash/scripts/pom.xml.exists.shbash:/scripts/pom.xml.exists.sh: 没有这样的文件或目录

有人可以让我知道我做错了什么吗?相反,也许是一个 shell 命令,它会告诉我我应该在哪个目录中。也许这会让我知道为什么我会收到未找到的消息。

谢谢

尝试

shell("bash scripts/pom.xml.exists.sh")

甚至

shell("scripts/pom.xml.exists.sh")

看起来您不小心使用了绝对路径,但您想要相对路径。

最新更新