我正在使用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)
答案 0 :(得分:4)
我怀疑您已经将JSLint插件的“日志文件”参数留空了。该插件将空文件名传递给JSLint,结果路径指向您的工作区目录;你可以在日志输出中看到:
在封面下,JSLint正在尝试打开一个用于写入的目录,这当然不会成功,因此您会看到“访问被拒绝”错误。
从文档中不清楚“日志文件”是必需的,但问题是通过为日志文件提供文件名来解决的,如下所示:
此外,请记住,如果您将JSLint作为预备步骤运行,则您的target
文件夹将不存在,因此如果您尝试使用它,则会看到另一个错误。