gpt4 book ai didi

java - Jenkins 管道 - 尝试加载外部 groovy 文件时没有此类文件或目录

转载 作者:行者123 更新时间:2023-11-30 06:55:49 26 4
gpt4 key购买 nike

我有一个 Jenkinsfile,如下所示:

node {

def rootDir = pwd()

def externalMethod = load("${rootDir}/ci/jenkins/shops.groovy")

// Call the method we defined in externalMethod.
externalMethod.lookAtThis("Simon")

}

另一个文件位于 ci/jenkins/shops.groovy

def lookAtThis(String whoAreYou) {
echo "Look at this, ${whoAreYou}! You loaded this from another file!"
}

但是 Jenkins 返回错误

java.io.IOException: java.io.FileNotFoundException: /root/workspace/lush-global-soa-architecture/develop/ci/jenkins/shops.groovy (No such file or directory)

我不知道为什么找不到这个文件。

最佳答案

我成功了,结果我需要先 checkout scm,然后才能加载文件。

checkout scm

关于java - Jenkins 管道 - 尝试加载外部 groovy 文件时没有此类文件或目录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41849460/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com