0

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?

Ufder
  • 527
  • 4
  • 20
  • Did you consider using the Gradle wrapper? it would help you not to depend on the Gradle version installed on the Jenkins instance. You should also try to execute Gradle with --info flag as said in the error message: `sh('gradle taskname --info')` : you should have more detail in build logs – M.Ricciuti Oct 22 '18 at 09:49
  • It seems that you are using/applying the gradle plugin *gradle-git* (this error message you get is coming from : https://github.com/ajoberstar/gradle-git/blob/master/src/main/groovy/org/ajoberstar/gradle/git/release/base/ReleasePluginExtension.groovy ) : so maybe you are missing one configuration in your build script that makes this plugin fail : see https://github.com/ajoberstar/gradle-git/wiki/Release%20Plugins#configuration – M.Ricciuti Oct 22 '18 at 10:04
  • yes, hence the tag `grgit`. Individually the task works fine. Its just when I call it from Jenkinsfile of the other project is when it fails. Not sure how I can address this. – Ufder Oct 22 '18 at 15:37

1 Answers1

0

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

Ufder
  • 527
  • 4
  • 20