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

Gradle plugin fails to save selected Gradle Version in Project configuration

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • gradle-plugin
    • None

      Hello,

      I have to following problem with the Gradle plugin for Jenkins:

      While editing the project configuration I am able to select one of the installed Gradle versions to use for "Invoke Gradle". After saving the project configuration, the value of "Gradle Version" falls back to "(Default)".

      Since I don't have (and don't intend to have) Gradle on the path, every build fails with the following message:

      [Gradle] - Launching build.
      [i4r-hire-build] $ cmd.exe /C gradle.bat build && exit %%ERRORLEVEL%%
      'gradle.bat' is not recognized as an internal or external command,
      operable program or batch file.
      Build step 'Invoke Gradle script' changed build result to FAILURE
      Build step 'Invoke Gradle script' marked build as failure
      Recording test results
      Finished: FAILURE
      

      I am using Gradle plugin version 1.19 and Jenkins version 1.481

          [JENKINS-15166] Gradle plugin fails to save selected Gradle Version in Project configuration

          Johannes Rost added a comment -

          Here is my Gradle plugin configuration (hudson.plugins.gradle.Gradle.xml):

          <?xml version='1.0' encoding='UTF-8'?>
          <hudson.plugins.gradle.Gradle_-DescriptorImpl>
            <helpRedirect/>
            <installations>
              <hudson.plugins.gradle.GradleInstallation>
                <name>Gradle_1_2 (Gradle.org)</name>
                <home></home>
                <properties>
                  <hudson.tools.InstallSourceProperty>
                    <installers>
                      <hudson.plugins.gradle.GradleInstaller>
                        <id>1.2</id>
                      </hudson.plugins.gradle.GradleInstaller>
                    </installers>
                  </hudson.tools.InstallSourceProperty>
                </properties>
                <gradleHome></gradleHome>
              </hudson.plugins.gradle.GradleInstallation>
              <hudson.plugins.gradle.GradleInstallation>
                <name>Gradle_1_2 (Lokal)</name>
                <home>D:\jenkins\tools\Gradle\gradle_1_2</home>
                <properties/>
                <gradleHome>D:\jenkins\tools\Gradle\gradle_1_2</gradleHome>
              </hudson.plugins.gradle.GradleInstallation>
            </installations>
          </hudson.plugins.gradle.Gradle_-DescriptorImpl>
          

          When editing a project configuration I can select both configurations.

          Johannes Rost added a comment - Here is my Gradle plugin configuration (hudson.plugins.gradle.Gradle.xml): <?xml version= '1.0' encoding= 'UTF-8' ?> <hudson.plugins.gradle.Gradle_-DescriptorImpl> <helpRedirect/> <installations> <hudson.plugins.gradle.GradleInstallation> <name> Gradle_1_2 (Gradle.org) </name> <home> </home> <properties> <hudson.tools.InstallSourceProperty> <installers> <hudson.plugins.gradle.GradleInstaller> <id> 1.2 </id> </hudson.plugins.gradle.GradleInstaller> </installers> </hudson.tools.InstallSourceProperty> </properties> <gradleHome> </gradleHome> </hudson.plugins.gradle.GradleInstallation> <hudson.plugins.gradle.GradleInstallation> <name> Gradle_1_2 (Lokal) </name> <home> D:\jenkins\tools\Gradle\gradle_1_2 </home> <properties/> <gradleHome> D:\jenkins\tools\Gradle\gradle_1_2 </gradleHome> </hudson.plugins.gradle.GradleInstallation> </installations> </hudson.plugins.gradle.Gradle_-DescriptorImpl> When editing a project configuration I can select both configurations.

          Sean Ford added a comment -

          Nice, I was just coming here to report the same bug. I had problems with Gradle plugin version 1.19 and Jenkins version 1.481. Reverting the Gradle plugin back to version 1.16 fixed the problem for me.

          I did some digging on this and it seams that the <gradleName/> property isn't being saved into a job's config.xml file. Example:

          ...
            <builders>
              <hudson.plugins.gradle.Gradle>
                <description></description>
                <switches></switches>
                <tasks>clean test</tasks>
                <rootBuildScriptDir></rootBuildScriptDir>
          
          <!-- <gradleName>YOUR_GRADLE_NAME</gradleName> should appear here -->
          
                <buildFile></buildFile>
                <useWrapper>false</useWrapper>
              </hudson.plugins.gradle.Gradle>
            </builders>
          ...
          

          For a work-around, you can add <gradleName>YOUR_GRADLE_NAME</gradleName> to your project's config.xml and then have Jenkins "Reload Configuration from Disk". This will fix gradle until you re-save the job's config.

          Sean Ford added a comment - Nice, I was just coming here to report the same bug. I had problems with Gradle plugin version 1.19 and Jenkins version 1.481. Reverting the Gradle plugin back to version 1.16 fixed the problem for me. I did some digging on this and it seams that the <gradleName/> property isn't being saved into a job's config.xml file. Example: ... <builders> <hudson.plugins.gradle.Gradle> <description></description> <switches></switches> <tasks>clean test</tasks> <rootBuildScriptDir></rootBuildScriptDir> <!-- <gradleName>YOUR_GRADLE_NAME</gradleName> should appear here --> <buildFile></buildFile> <useWrapper>false</useWrapper> </hudson.plugins.gradle.Gradle> </builders> ... For a work-around, you can add <gradleName>YOUR_GRADLE_NAME</gradleName> to your project's config.xml and then have Jenkins "Reload Configuration from Disk". This will fix gradle until you re-save the job's config.

          Code changed in jenkins
          User: Nicolas De Loof
          Path:
          src/main/resources/hudson/plugins/gradle/Gradle/config.jelly
          http://jenkins-ci.org/commit/gradle-plugin/17bd2e4f5a11a5ef81fc67913d6ba5ac933f4ba4
          Log:
          [FIXED JENKINS-15166] gradleName "lost" due to refactoring of web UI

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Nicolas De Loof Path: src/main/resources/hudson/plugins/gradle/Gradle/config.jelly http://jenkins-ci.org/commit/gradle-plugin/17bd2e4f5a11a5ef81fc67913d6ba5ac933f4ba4 Log: [FIXED JENKINS-15166] gradleName "lost" due to refactoring of web UI

          Johannes Rost added a comment -

          Since the Problem seems to be fixed, I would like to know when the fix is available. Can someone tell me?

          Johannes Rost added a comment - Since the Problem seems to be fixed, I would like to know when the fix is available. Can someone tell me?

          The fix is available in version 1.20, available since Sept.19.

          Wiki page is updated
          https://wiki.jenkins-ci.org/display/JENKINS/Gradle+Plugin

          Manual download here
          http://repo.jenkins-ci.org/releases/org/jenkins-ci/plugins/gradle/1.20/

          If you any further problems, please let me know.

          Gregory Boissinot added a comment - The fix is available in version 1.20, available since Sept.19. Wiki page is updated https://wiki.jenkins-ci.org/display/JENKINS/Gradle+Plugin Manual download here http://repo.jenkins-ci.org/releases/org/jenkins-ci/plugins/gradle/1.20/ If you any further problems, please let me know.

          Johannes Rost added a comment -

          Version 1.20 of the Plugin works as expected.

          Johannes Rost added a comment - Version 1.20 of the Plugin works as expected.

            gbois Gregory Boissinot
            johannesrost Johannes Rost
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: