Run a task from a different git repo in Jenkinsfile

681 Views Asked by At

In my projects Jenkinsfile, I need to clone another github repo, and run a specific task. This is what I was trying:

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

The git repo clone works fine. But I am not able to run any task. I get an error

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.

How can I get past this?

1

There are 1 best solutions below

0
Ufder On

I was able to solve this using the build option from the pipeline: https://jenkins.io/doc/pipeline/steps/pipeline-build-step/