首页 > 解决方案 > 从 Jenkinsfile 中的不同 git repo 运行任务

问题描述

在我的项目Jenkinsfile中,我需要克隆另一个 github 存储库,并运行特定任务。这就是我正在尝试的:

stage ('mystage') {
    dir('foo') {
        git url: 'https://github.com/something.git'
    }
    sh('cd foo')
    sh('gradle taskname')
}

git repo 克隆工作正常。但我无法运行任何任务。我收到一个错误

11:23:16 > Failed to apply plugin [id 'org.gradle.java']
11:23:16      > No version strategies were selected. Run build with --info for more detail.

我怎样才能克服这个?

标签: gradlejenkins-pipelinegrgit

解决方案


我能够使用build管道中的选项解决这个问题:https ://jenkins.io/doc/pipeline/steps/pipeline-build-step/


推荐阅读