This plugin makes it possible to invoke a Gradle build script as the main build step.

Description

This plugin adds Gradle Support to Jenkins. Gradle is managed as another tool inside Jenkins (the same way as Ant or Maven), including support for automatic installation and a new build step is provided to execute Gradle tasks.

Configuration

Gradle configuration is performed in the Configure System (before Jenkins 2.0) or Global Tool Configuration (starting in Jenkins 2.0). In both cases these options reside in the Manage Jenkins section.

In the Gradle section provided by this plugin, several installations can be configured:

The system provides both automatic installation, which can be performed by directly downloading from the Gradle web site, extracting a compressed final or executing some shell commands. Besides, for nodes which already has Gradle installed, the tool can by manually configured, by unchecking the Install automatically checkbox and providing the base path (GRADLE_HOME) of the installation.

Usage

The first configuration option is whether to use one of the installation configured in Jenkins (see previous section) of use the Gradle Wrapper which is the Gradle-provided mechanism to "embed" the use of a specific Gradle version in a build, installing it if neccessary.

Other configuration options include:

A description to use for the build step.

Switches (options) to provide to the Gradle execution.

Tasks to execute (if blanck the defaults tasks of the build will be invoked).

Path to the build script if different from the root directory of the build.

Name of the build script if different from build.gradle.

If a Gradle Build Scan is produced during a build, then a link to it is added to the build page.

Release 1.24

Release 1.23

* Fix issue #17386 - Gradle.properties ignored after 1.22 upgrade. GRADLE_USER_HOME is now no longer set to the workspace of the job by default. If you wish to have the workspace job as the GRADLE_USER_HOME, you will need to change the config to reflect this.

Release 1.22

Release 1.21

* Add the ability to allow gradlew to still be run from workspace top, but to also configure it so that gradlew is found in the root build script directory. * Fix JENKINS-12769 - Cannot specify location of gradle wrapper * Fix JENKINS-15406 - When using gradlew, root build script field is not used to locate gradlew

Release 1.4 (June, 09, 2010)

Release 1.3 (February 23, 2010)

The plugin makes it possible to extract a Gradle distribution from a shared location or from a command line, and uses this distribution for running the build.

Release 1.2 (February 07, 2009)

Add a distinction between switches and tasks

The plugin makes its possible to specify the location of the build script if the workspace has a top-level build.gradle in somewhere other than the module root directory

Improve user help messages

Release 1.1 (November 07, 2008)

Add the support of Gradle 0.5 Before the version 0.5, the gradle windows executable file was "gradle.exe" and you lost the ERRORLEVEL value. From Gradle 0.5, the window launcher is a .bat file that conserves the correct ERRORLEVEL value.

Release 1.0 (October 04, 2008)

12 Comments

I am using the Gradle plugin in my Jenkins installation and everything works fine. I am just curious if there is any way how to show gradle build profile report in Jenkins (I run a gradle build with switch --profile).

There is no special requirement if you want to support the daemon. Just start the daemon as you would on the command line. If you run into some issues (as Jenkins killing the daemon after the build step finishes) please open a JIRA issue.

Trying to look at the console output of a build job which uses this Gradle plugin results in a near-immediate browser crash. In trying to figure out why this is happening, I discovered that while in the console view of a build there hundreds and hundreds (possibly infinite) of "Executed Gradle Tasks" boxes along the left-hand edge of the screen. All of these "Executed Gradle Tasks" boxes are empty, but there are so many that I am fairly certain this is what is crashing the browser.

This works very well actually, and also shows the gradlew output in the Jenkins build log so you can still what is happening as gradlew runs. I use gradlew.bat because it starts and stops the gradle daemon for each build, which is recommended for a build server.

Could you create a JIRA issue for that? It would be great if you could provide a reproducible example so I could look into it. Just telling me the number of executed tasks or a build scan would probably suffice, too.

I have configure gradle on Jenkins 2.101, and it works fine on a freestyle job ("Invoke gradle script"), but is not getting recognized from a pipeline job(jenkinsfile). What configuration is required for this??