Jenkins 2.60.2返回" CreateProcess error = 267,目录名无效"在运行Gradle Task时

时间:2017-07-24 01:14:25

标签: java jenkins gradle

我刚刚使用Windows Installer安装了Jenkins 2.60.2,然后将其配置为运行我的Gradle任务。

我的build.gradle位于C:\ Workspace \ SSD \ build.gradle中,因此我将路径放在Jenkins的配置页面,字段" Root Build脚本中:" C:\Workspace\SSD\build.gradle

当我点击"立即构建" ,詹金斯回归

Building in workspace C:\Program Files (x86)\Jenkins\workspace\Testing
[Gradle] - Launching build.
[build.gradle] $ cmd.exe /C "gradle.bat gradle clean test -PSSD && exit %%ERRORLEVEL%%"
The directory name is invalid
FATAL: command execution failed
java.io.IOException: Cannot run program "cmd.exe" (in directory "C:\Workspace\SSD\build.gradle"): CreateProcess error=267, The directory name is invalid
    at java.lang.ProcessBuilder.start(Unknown Source)
    at hudson.Proc$LocalProc.<init>(Proc.java:245)
    at hudson.Proc$LocalProc.<init>(Proc.java:214)
    at hudson.Launcher$LocalLauncher.launch(Launcher.java:850)
    at hudson.Launcher$ProcStarter.start(Launcher.java:384)
    at hudson.Launcher$ProcStarter.join(Launcher.java:395)
    at hudson.plugins.gradle.Gradle.performTask(Gradle.java:330)
    at hudson.plugins.gradle.Gradle.perform(Gradle.java:221)
    at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
    at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:735)
    at hudson.model.Build$BuildExecution.build(Build.java:206)
    at hudson.model.Build$BuildExecution.doRun(Build.java:163)
    at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:490)
    at hudson.model.Run.execute(Run.java:1735)
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
    at hudson.model.ResourceController.execute(ResourceController.java:97)
    at hudson.model.Executor.run(Executor.java:405)
Caused by: java.io.IOException: CreateProcess error=267, The directory name is invalid
    at java.lang.ProcessImpl.create(Native Method)
    at java.lang.ProcessImpl.<init>(Unknown Source)
    at java.lang.ProcessImpl.start(Unknown Source)
    ... 17 more
Build step 'Invoke Gradle script' changed build result to FAILURE
Build step 'Invoke Gradle script' marked build as failure
Finished: FAILURE

我更改了字段&#34; Root Build脚本&#34;到C:\\Workspace\\SSD\\build.gradle,仍然无法运作。

当我使用gradle(没有Jenkins)构建我的代码时,它工作正常。

可能有任何线索?
谢谢。

1 个答案:

答案 0 :(得分:1)

https://wiki.jenkins.io/display/JENKINS/Gradle+Plugin的文档以及它给出的错误,它需要该配置选项中的构建脚本的文件夹,而不是脚本本身的完整路径。将其更改为C:\Workspace\SSD,我希望它能够正常运行。