Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-24682

Gradle Wrapper not working when gradle version was previously selected

      If the gradlew script is not in the root of the project and the build configuration is changed from using a specific version to using the gradle wrapper the build fails with:

      Can't retrieve the Gradle executable.

        1. config-1.JPG
          config-1.JPG
          46 kB
        2. config-2.JPG
          config-2.JPG
          38 kB
        3. jenkins-24682.zip
          50 kB

          [JENKINS-24682] Gradle Wrapper not working when gradle version was previously selected

          Mario Mohr added a comment -

          From my point of view the plugin should not consider the installed tools at all if gradle wrapper is selected. If created a pull request here: https://github.com/jenkinsci/gradle-plugin/pull/23

          Mario Mohr added a comment - From my point of view the plugin should not consider the installed tools at all if gradle wrapper is selected. If created a pull request here: https://github.com/jenkinsci/gradle-plugin/pull/23

          Daniel Beck added a comment -

          Are you manipulating the Gradle build step programmatically, or how can this issue be reproduced?

          Daniel Beck added a comment - Are you manipulating the Gradle build step programmatically, or how can this issue be reproduced?

          Mario Mohr added a comment -

          No, I'm not manipulating the build programmatically. I switched a build from a fixed version to gradlew like shown in the two screenshots attached. After the change, the gradleName property is still set in the config file. The current logic in Gradle.java is still trying to use the tool version, although it should use the wrapper and the gradle version that comes with it. See the attached jenkins-24682.zip file for a minimal example that fails with the current code and is fixed in my pull request.

          Mario Mohr added a comment - No, I'm not manipulating the build programmatically. I switched a build from a fixed version to gradlew like shown in the two screenshots attached. After the change, the gradleName property is still set in the config file. The current logic in Gradle.java is still trying to use the tool version, although it should use the wrapper and the gradle version that comes with it. See the attached jenkins-24682.zip file for a minimal example that fails with the current code and is fixed in my pull request.

          Mario Mohr added a comment -

          BTW: A workaround with the current release is to to set the gradle version to default before switching to gradlew, but this is not really intuitive.

          Mario Mohr added a comment - BTW: A workaround with the current release is to to set the gradle version to default before switching to gradlew, but this is not really intuitive.

          Code changed in jenkins
          User: Mario Mohr
          Path:
          src/main/java/hudson/plugins/gradle/Gradle.java
          src/main/java/hudson/plugins/gradle/GradleInstallation.java
          http://jenkins-ci.org/commit/gradle-plugin/ace07ad4e0a801fcb3afb37a907b83b21586e3a7
          Log:
          [FIXED JENKINS-24682]

          Jenkins gradle installations are ignored if gradle wrapper is selected

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Mario Mohr Path: src/main/java/hudson/plugins/gradle/Gradle.java src/main/java/hudson/plugins/gradle/GradleInstallation.java http://jenkins-ci.org/commit/gradle-plugin/ace07ad4e0a801fcb3afb37a907b83b21586e3a7 Log: [FIXED JENKINS-24682] Jenkins gradle installations are ignored if gradle wrapper is selected

          Code changed in jenkins
          User: Gregory Boissinot
          Path:
          src/main/java/hudson/plugins/gradle/Gradle.java
          src/main/java/hudson/plugins/gradle/GradleInstallation.java
          http://jenkins-ci.org/commit/gradle-plugin/8730d78a456cad424db4061a272adb4b9631e9f3
          Log:
          Merge pull request #23 from mamohr/JENKINS-24682

          [FIXED JENKINS-24682]

          Compare: https://github.com/jenkinsci/gradle-plugin/compare/763256601be2...8730d78a456c

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Gregory Boissinot Path: src/main/java/hudson/plugins/gradle/Gradle.java src/main/java/hudson/plugins/gradle/GradleInstallation.java http://jenkins-ci.org/commit/gradle-plugin/8730d78a456cad424db4061a272adb4b9631e9f3 Log: Merge pull request #23 from mamohr/ JENKINS-24682 [FIXED JENKINS-24682] Compare: https://github.com/jenkinsci/gradle-plugin/compare/763256601be2...8730d78a456c

            gbois Gregory Boissinot
            mamohr Mario Mohr
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: