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

Gradle build command not working as Gradle version is unavailable for selection in Configure

      My gradle build works fine when I do it via the command prompt. While doing it via Jenkins, I get the following error:
      Started by user anonymous
      Building in workspace /var/lib/jenkins/jobs/unite/workspace
      [Gradle] - Launching build.
      [workspace] $ gradle build -b /run/media/navin/Data/GitRepositories/unite/build.gradle
      FATAL: command execution failed
      java.io.IOException: Cannot run program "gradle" (in directory "/var/lib/jenkins/jobs/unite/workspace"): error=2, No such file or directory
      at java.lang.ProcessBuilder.start(ProcessBuilder.java:1041)
      at hudson.Proc$LocalProc.<init>(Proc.java:244)
      at hudson.Proc$LocalProc.<init>(Proc.java:216)
      at hudson.Launcher$LocalLauncher.launch(Launcher.java:773)
      at hudson.Launcher$ProcStarter.start(Launcher.java:353)
      at hudson.Launcher$ProcStarter.join(Launcher.java:360)
      at hudson.plugins.gradle.Gradle.performTask(Gradle.java:236)
      at hudson.plugins.gradle.Gradle.perform(Gradle.java:118)
      at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
      at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:784)
      at hudson.model.Build$BuildExecution.build(Build.java:199)
      at hudson.model.Build$BuildExecution.doRun(Build.java:160)
      at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:565)
      at hudson.model.Run.execute(Run.java:1670)
      at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
      at hudson.model.ResourceController.execute(ResourceController.java:88)
      at hudson.model.Executor.run(Executor.java:231)
      Caused by: java.io.IOException: error=2, No such file or directory
      at java.lang.UNIXProcess.forkAndExec(Native Method)
      at java.lang.UNIXProcess.<init>(UNIXProcess.java:135)
      at java.lang.ProcessImpl.start(ProcessImpl.java:130)
      at java.lang.ProcessBuilder.start(ProcessBuilder.java:1022)
      ... 16 more
      Build step 'Invoke Gradle script' changed build result to FAILURE
      Build step 'Invoke Gradle script' marked build as failure
      Collecting metadata...
      Metadata collection done.
      Finished: FAILURE

      Google searching showed the error could be because of not selecting the Gradle version http://stackoverflow.com/questions/8646762/cannot-run-program-gradle-in-jenkins

      But when I click the dropdown menu to select the Gradle version, there is no version number shown at all. There's just "Default".
      I'm using version 1.23 of the Gradle plugin, Firefox version 25, using Jenkins.war and starting it as sudo service jenkins start on localhost:8080. Using jdk1.7.0_45. This is my first install of Jenkins.

          [JENKINS-21653] Gradle build command not working as Gradle version is unavailable for selection in Configure

          John Engelman added a comment -

          You'll need to configure a Gradle installation under Jenkins | Manage Jenkins | Gradle.
          There you can set up different installations to either installed locations on the file system or have Jenkins automatically install it from gradle.org.

          John Engelman added a comment - You'll need to configure a Gradle installation under Jenkins | Manage Jenkins | Gradle. There you can set up different installations to either installed locations on the file system or have Jenkins automatically install it from gradle.org.

          Navin I added a comment -

          @John: Couldn't find any "Gradle" option under "Manage Jenkins".

          Navin I added a comment - @John: Couldn't find any "Gradle" option under "Manage Jenkins".

          @Navin, you have to go under Jenkins | Manage Jenkins | Configure system | Gradle

          Gregory SSI-YAN-KAI added a comment - @Navin, you have to go under Jenkins | Manage Jenkins | Configure system | Gradle

          This does not seem to be related to the Gradle JPI Plugin, which is a plugin for Gradle to build Jenkins plugins.

          Daniel Spilker added a comment - This does not seem to be related to the Gradle JPI Plugin, which is a plugin for Gradle to build Jenkins plugins.

          Navin I added a comment -

          Sorry about the late reply, but I had to do a full HDD format and don't have Fedora installed anymore. I have Ubuntu, and after installing the Gradle plugin, I went to Jenkins | Manage Jenkins | Configure system | Gradle and Jenkins extracted the 39MB file and when I created my project on Jenkins and selected the gradle build, it worked fine.

          I think the problem happens when a person uses the shell option or the windows batch command option to directly specify the commandline option to run gradle and it gives this error
          Started by user anonymous
          Building in workspace /root/.jenkins/jobs/unite_commandline/workspace
          [workspace] $ /bin/sh -xe /usr/local/apache-tomee-plus-1.5.2/temp/hudson7286277119787018900.sh
          + /home/navin/unite/gradle build
          /usr/local/apache-tomee-plus-1.5.2/temp/hudson7286277119787018900.sh: 2: /usr/local/apache-tomee-plus-1.5.2/temp/hudson7286277119787018900.sh: /home/navin/unite/gradle: Permission denied
          Build step 'Execute shell' marked build as failure
          Finished: FAILURE

          I think the correct method is what John and Gregory suggested, about configuring Gradle first and then running the build using the plugin.

          Navin I added a comment - Sorry about the late reply, but I had to do a full HDD format and don't have Fedora installed anymore. I have Ubuntu, and after installing the Gradle plugin, I went to Jenkins | Manage Jenkins | Configure system | Gradle and Jenkins extracted the 39MB file and when I created my project on Jenkins and selected the gradle build, it worked fine. I think the problem happens when a person uses the shell option or the windows batch command option to directly specify the commandline option to run gradle and it gives this error Started by user anonymous Building in workspace /root/.jenkins/jobs/unite_commandline/workspace [workspace] $ /bin/sh -xe /usr/local/apache-tomee-plus-1.5.2/temp/hudson7286277119787018900.sh + /home/navin/unite/gradle build /usr/local/apache-tomee-plus-1.5.2/temp/hudson7286277119787018900.sh: 2: /usr/local/apache-tomee-plus-1.5.2/temp/hudson7286277119787018900.sh: /home/navin/unite/gradle: Permission denied Build step 'Execute shell' marked build as failure Finished: FAILURE I think the correct method is what John and Gregory suggested, about configuring Gradle first and then running the build using the plugin.

            gbois Gregory Boissinot
            nav Navin I
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: