Jenkins构建时的java

Jenkins构建时的java

本文介绍了Jenkins构建时的java.nio.file.AccessDeniedException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在MacOSX Server上设置Jenkins系统,以便在svn签入后自动构建.但是,当构建开始时,我在控制台输出中得到了这些Java错误.有没有人与詹金斯有经验并且有这些错误?

I'm setting up a Jenkins system at MacOSX Server for an automatically build after a svn checkin. But when the build is starting I get these java error at the console output. Does anyone have experience with Jenkins and these error?

Gestartet durch Benutzer anonymous
[EnvInject] - Loading node environment variables.
Baue in Workspace /Users/Shared/Jenkins/Home/jobs/myProject/workspace
Cleaning local Directory .
java.nio.file.AccessDeniedException: /Users/Shared/Jenkins/Home/jobs/my Project/workspace/./.svn/pristine/04/040d4cd4de48d844246c38e096a78718879bfafb.svn-base
	at sun.nio.fs.UnixException.translateToIOException(UnixException.java:84)
	at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
	at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
	at sun.nio.fs.UnixFileSystemProvider.implDelete(UnixFileSystemProvider.java:244)
	at sun.nio.fs.AbstractFileSystemProvider.delete(AbstractFileSystemProvider.java:103)
	at java.nio.file.Files.delete(Files.java:1126)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)
	at hudson.Util.deleteFile(Util.java:255)
	at hudson.Util.deleteRecursive(Util.java:318)
	at hudson.Util.deleteContentsRecursive(Util.java:220)
	at hudson.Util.deleteRecursive(Util.java:309)
	at hudson.Util.deleteContentsRecursive(Util.java:220)
	at hudson.Util.deleteRecursive(Util.java:309)
	at hudson.Util.deleteContentsRecursive(Util.java:220)
	at hudson.Util.deleteRecursive(Util.java:309)
	at hudson.Util.deleteContentsRecursive(Util.java:220)
	at hudson.scm.subversion.CheckoutUpdater$1.perform(CheckoutUpdater.java:81)
	at hudson.scm.subversion.WorkspaceUpdater$UpdateTask.delegateTo(WorkspaceUpdater.java:162)
	at hudson.scm.SubversionSCM$CheckOutTask.perform(SubversionSCM.java:988)
	at hudson.scm.SubversionSCM$CheckOutTask.invoke(SubversionSCM.java:969)
	at hudson.scm.SubversionSCM$CheckOutTask.invoke(SubversionSCM.java:945)
	at hudson.FilePath.act(FilePath.java:990)
	at hudson.FilePath.act(FilePath.java:968)
	at hudson.scm.SubversionSCM.checkout(SubversionSCM.java:894)
	at hudson.scm.SubversionSCM.checkout(SubversionSCM.java:830)
	at hudson.scm.SCM.checkout(SCM.java:485)
	at hudson.model.AbstractProject.checkout(AbstractProject.java:1276)
	at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:607)
	at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
	at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:529)
	at hudson.model.Run.execute(Run.java:1738)
	at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
	at hudson.model.ResourceController.execute(ResourceController.java:98)
	at hudson.model.Executor.run(Executor.java:410)
Sending e-mails to: m...
Finished: FAILURE

推荐答案

之所以出现此问题,是因为您没有在Jenkins作业目录(在您的情况下为/Users/Shared/Jenkins/Home/jobs)上执行作业的权限.

This problem is occurring because you don't have permission to execute the job on the Jenkins jobs dir (in your case /Users/Shared/Jenkins/Home/jobs).

当我尝试将作业目录从一台服务器复制到另一个服务器时,我遇到了同样的问题.

I got the same problem when I tried to copy the jobs dir from a server to another.

要解决此问题,我们需要将jobs的所有者更改为jenkins用户:

To solve this we need to change the owner of jobs to the jenkins user:

sudo chown -R jenkins:jenkins jobs

这将解决您的问题.

这篇关于Jenkins构建时的java.nio.file.AccessDeniedException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-30 01:15