What is “GRADLE_LATEST”?
You need to go Jenkins and install Gradle Plugin then add  Gradle to the tool 
in Jenkins 2.x:  Go to Manage Jenkins -> Global Tool Configuration -> Gradle 
Installation;  In Jenkins 1.x: Go to Manage Jenkins -> Configure System -> 
Gradle

For a Gradle version you install you specify a label and then use that label 
ex. “Gradle-2.14” in the declarative pipeline

tools {
    gradle “Gradle-2.14”
    …

}

On the node/agent, you better make sure the Gradle you install also available 
in the same installation location you just did above.


-Indra

From: <[email protected]> on behalf of Bill Dennis 
<[email protected]>
Reply-To: "[email protected]" <[email protected]>
Date: Wednesday, February 15, 2017 at 6:40 PM
To: Jenkins Users <[email protected]>
Subject: declarative pipeline - gradle build tool not working

Hi -

I'm looking to use gradle to run tests in declarative pipeline jobs.

Looking at docs here under tools I should be able to spec a gradle tool in the 
tools section:
https://jenkins.io/doc/book/pipeline/syntax/#declarative-steps

So I created a job like this:

pipeline {
    agent any
    tools {
        gradle "GRADLE_LATEST"
    }
    stages {
        stage('Gradle') {
            steps {
                sh 'gradle --version'
            }
        }
    }
}

But I am getting an error that gradle is not a valid tool type:


org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:

WorkflowScript: 4: Invalid tool type "gradle". Valid tool types: [ant, 
hudson.tasks.Ant$AntInstallation, 
com.cloudbees.jenkins.plugins.customtools.CustomTool, 
org.jenkinsci.plugins.docker.commons.tools.DockerTool, git, 
hudson.plugins.git.GitTool, hudson.plugins.gradle.GradleInstallation, 
hudson.plugins.groovy.GroovyInstallation, jdk, hudson.model.JDK, jgit, 
org.jenkinsci.plugins.gitclient.JGitTool, jgitapache, 
org.jenkinsci.plugins.gitclient.JGitApacheTool, maven, 
hudson.tasks.Maven$MavenInstallation, 
hudson.plugins.mercurial.MercurialInstallation] @ line 4, column 9.

           gradle "GRADLE_LATEST"

           ^



1 error



This is on Jenkins Enterprise 2.32.1.1 with version 1.0 of the Pipeline Model 
plugins installed and with the gradle tool plugin installed and configured.



Has anyone got gradle to work with declarative pipeline?



I think I had it working with scripted pipeline sytax but I prefer this tools 
section.



Thanks for any help,

Bill
--
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to 
[email protected]<mailto:[email protected]>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/e5506ea0-e080-47b3-b885-cba24454ea61%40googlegroups.com<https://groups.google.com/d/msgid/jenkinsci-users/e5506ea0-e080-47b3-b885-cba24454ea61%40googlegroups.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/3296514F-78FE-4B4A-8FA7-0BF3FFB714FF%40cisco.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to