1

我正在使用 jslint 插件运行 jenkins 工作。我的构建失败并出现以下错误,在工作区拒绝访问。我应该给工作区任何文件权限吗?我正在使用 git 来签出项目,并且文件得到了很好的签出。任何人都可以给我一些关于下面提到的错误的指示吗?

Started by user anonymous
Building in workspace C:\Program Files\Jenkins\jobs\test\workspace
Checkout:workspace / C:\Program Files\Jenkins\jobs\test\workspace - hudson.remoting.LocalChannel@10d4b20
Using strategy: Default
Last Built Revision: Revision 13460c60318e0c4859473d848dd81f76073fe34e (origin/master, origin/HEAD)
Fetching changes from 1 remote Git repository
Fetching upstream changes from origin
Seen branch in repository origin/HEAD
Seen branch in repository origin/master
Seen 2 remote branches
Commencing build of Revision 13460c60318e0c4859473d848dd81f76073fe34e (origin/master, origin/HEAD)
Checking out Revision 13460c60318e0c4859473d848dd81f76073fe34e (origin/master, origin/HEAD)
Warning : There are multiple branch changesets here
[JSLint] Ready
[JSLint] calling jslint with args[-DxmlOutput=C:\Program Files\Jenkins\jobs\test\workspace/, C:\Program Files\Jenkins\jobs\test\workspace\readme.js]
[JSLint] JSLint path is jar:file:/C:/Program Files/Jenkins/plugins/jslint/WEB-INF/lib/classes.jar!/com/boxuk/jenkins/jslint/JSLintBuilder/jslint.js
FATAL: Wrapped java.io.FileNotFoundException: C:\Program Files\Jenkins\jobs\test\workspace (Access is denied) (jslint.js#5732)
org.mozilla.javascript.WrappedException: Wrapped java.io.FileNotFoundException: C:\Program Files\Jenkins\jobs\test\workspace (Access is denied) (jslint.js#5732)
    at org.mozilla.javascript.Context.throwAsScriptRuntimeEx(Context.java:1773)
    at org.mozilla.javascript.MemberBox.newInstance(MemberBox.java:202)
    at org.mozilla.javascript.NativeJavaClass.constructSpecific(NativeJavaClass.java:281)
    at org.mozilla.javascript.NativeJavaClass.construct(NativeJavaClass.java:200)
    at org.mozilla.javascript.ScriptRuntime.newObject(ScriptRuntime.java:2327)
    at org.mozilla.javascript.gen.c6._c149(jslint.js:5732)
    at org.mozilla.javascript.gen.c6.call(jslint.js)
    at org.mozilla.javascript.optimizer.OptRuntime.call1(OptRuntime.java:66)
    at org.mozilla.javascript.gen.c6._c0(jslint.js:5591)
    at org.mozilla.javascript.gen.c6.call(jslint.js)
    at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:398)
    at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3065)
    at org.mozilla.javascript.gen.c6.call(jslint.js)
    at org.mozilla.javascript.gen.c6.exec(jslint.js)
    at org.mozilla.javascript.Context.evaluateReader(Context.java:1135)
    at com.boxuk.jenkins.jslint.LintRunner.call(LintRunner.java:126)
    at com.boxuk.jenkins.jslint.LintRunner.call(LintRunner.java:28)
    at hudson.remoting.LocalChannel.call(LocalChannel.java:45)
    at com.boxuk.jenkins.jslint.JSLintBuilder.perform(JSLintBuilder.java:116)
    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.FileNotFoundException: C:\Program Files\Jenkins\jobs\test\workspace (Access is denied)
    at java.io.FileOutputStream.open(Native Method)
    at java.io.FileOutputStream.<init>(Unknown Source)
    at java.io.FileOutputStream.<init>(Unknown Source)
    at java.io.FileWriter.<init>(Unknown Source)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
    at java.lang.reflect.Constructor.newInstance(Unknown Source)
    at org.mozilla.javascript.MemberBox.newInstance(MemberBox.java:194)
4

1 回答 1

4

我怀疑您将 JSLint 插件的“日志文件”参数留为空白。插件将一个空文件名传递给 JSLint,生成的路径指向您的工作区目录;您可以在日志输出中看到:

在此处输入图像描述

在幕后,JSLint 正在尝试打开一个目录进行写入,这当然不会成功,因此您会看到“访问被拒绝”错误。

从文档中不清楚是否需要“日志文件”,但是通过为日志文件提供文件名来解决问题,如下所示:

在此处输入图像描述

另外,请记住,target如果您将 JSLint 作为前置步骤运行,您的文件夹将不存在,因此如果您尝试使用它,您会看到另一个错误。

于 2013-09-18T23:25:26.493 回答