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

When using gradlew, root build script field is not used to locate gradlew

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Minor
    • Resolution: Fixed
    • Component/s: gradle-plugin
    • Labels:
      None
    • Environment:
      gradle plugin 1.20
    • Similar Issues:

      Description

      It seems "root build script" is not really well taken when using gradlew.

      For instance, I have a git repository having a foo/build.gradle script.
      I then set "root build script" to "${WORKSPACE}/foo/"

      I would like to execute :

      $\{WORKSPACE\}/foo/gradlew 
      

      But for now, it is some sort of :

      $\{WORKSPACE\}/gradlew -p $\{WORKSPACE\}/foo
      

      I think we should define gradlew location (relative to checked out root repository) because for the moment, the only way to workaround the problem is to put gradlew in the root scm hierarchy

        Attachments

          Activity

          Hide
          theprophet31337 Nicolas Mongrain-Lacombe added a comment -

          With Jenkins Gradle plugin 1.23

          I specified Ab2edemo as my root build script.

          [Gradle] - Launching build.
          [Ab2edemo] $ /var/lib/jenkins/jobs/Ab2edemo/workspace/gradlew --stacktrace clean build
          FATAL: command execution failed
          java.io.IOException: Cannot run program "/var/lib/jenkins/jobs/Ab2edemo/workspace/gradlew" (in directory "/var/lib/jenkins/jobs/Ab2edemo/workspace/Ab2edemo"): 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:804)
          	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:586)
          	at hudson.model.Run.execute(Run.java:1603)
          	at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
          	at hudson.model.ResourceController.execute(ResourceController.java:88)
          	at hudson.model.Executor.run(Executor.java:247)
          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
          
          Show
          theprophet31337 Nicolas Mongrain-Lacombe added a comment - With Jenkins Gradle plugin 1.23 I specified Ab2edemo as my root build script. [Gradle] - Launching build. [Ab2edemo] $ / var /lib/jenkins/jobs/Ab2edemo/workspace/gradlew --stacktrace clean build FATAL: command execution failed java.io.IOException: Cannot run program "/ var /lib/jenkins/jobs/Ab2edemo/workspace/gradlew" (in directory "/ var /lib/jenkins/jobs/Ab2edemo/workspace/Ab2edemo" ): 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:804) 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:586) at hudson.model.Run.execute(Run.java:1603) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46) at hudson.model.ResourceController.execute(ResourceController.java:88) at hudson.model.Executor.run(Executor.java:247) 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
          Hide
          denis_zhdanov Denis Zhdanov added a comment -

          Hello,

          Encountered that bug today. Checked jenkins gradle plugin sources and provided a fix - please check this pull request

          Regards, Denis

          Show
          denis_zhdanov Denis Zhdanov added a comment - Hello, Encountered that bug today. Checked jenkins gradle plugin sources and provided a fix - please check this pull request Regards, Denis
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: denis.zhdanov
          Path:
          src/main/java/hudson/plugins/gradle/Gradle.java
          http://jenkins-ci.org/commit/gradle-plugin/19a81cfa7f1ee6073a0b589811cba61e9763c569
          Log:
          [FIXED JENKINS-15406]

          Use gradle wrapper from a project which is located not at the workspace root

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: denis.zhdanov Path: src/main/java/hudson/plugins/gradle/Gradle.java http://jenkins-ci.org/commit/gradle-plugin/19a81cfa7f1ee6073a0b589811cba61e9763c569 Log: [FIXED JENKINS-15406] Use gradle wrapper from a project which is located not at the workspace root
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Gregory Boissinot
          Path:
          src/main/java/hudson/plugins/gradle/Gradle.java
          http://jenkins-ci.org/commit/gradle-plugin/8e6f838a6d051ca087b2e936be61b0e7675c75c8
          Log:
          Merge pull request #21 from denis-zhdanov/master

          [FIXED JENKINS-15406]

          Compare: https://github.com/jenkinsci/gradle-plugin/compare/1dac78bcda1a...8e6f838a6d05

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Gregory Boissinot Path: src/main/java/hudson/plugins/gradle/Gradle.java http://jenkins-ci.org/commit/gradle-plugin/8e6f838a6d051ca087b2e936be61b0e7675c75c8 Log: Merge pull request #21 from denis-zhdanov/master [FIXED JENKINS-15406] Compare: https://github.com/jenkinsci/gradle-plugin/compare/1dac78bcda1a...8e6f838a6d05

            People

            • Assignee:
              gbois Gregory Boissinot
              Reporter:
              fcamblor Frédéric Camblor
            • Votes:
              2 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: