最近項目用的jenkins打包出現(xiàn)了問題,報錯如下倍奢,
·····························
·····························
<pre class="console-output" style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-decoration: none; box-sizing: border-box; white-space: pre-wrap; word-wrap: break-word; margin: 0px; caret-color: rgb(51, 51, 51); color: rgb(51, 51, 51); font-size: 13px;">Starting a Gradle Daemon (subsequent builds will be faster)
Parallel execution with configuration on demand is an incubating feature.
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'Android_dev'.
> Could not resolve all dependencies for configuration ':classpath'.
> java.io.IOException: Permission denied
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at [https://help.gradle.org](https://help.gradle.org/)</pre>
·····························
·····························
在各種找問題缺猛,花費了不少時間剔桨∧啦瘢可能是關鍵詞沒有找對醉途,在經(jīng)歷了九九八十一難之后。找到了線索:
I've just installed Jenkins onto Tomcat which already has other webapps running properly.
When I try to build a Maven job, it gives me an exception as below (only the relevant part of it!):
Caused by: java.io.IOException: Permission denied
at java.io.UnixFileSystem.createFileExclusively(Native Method)
at java.io.File.checkAndCreate(File.java:1704)
at java.io.File.createTempFile(File.java:1792)
at java.io.File.createTempFile(File.java:1828)
at hudson.remoting.RemoteClassLoader.createTempDir(RemoteClassLoader.java:281)
at hudson.remoting.RemoteClassLoader.makeResource(RemoteClassLoader.java:262)
at hudson.remoting.RemoteClassLoader.findResource(RemoteClassLoader.java:194)
... 31 more
After some research, it turned out that
$ ls -ald /tmp
drwxr-xr-x 8 root root 1024 2011-11-27 16:34 /tmp
Hummmm.... That's why a temporary file could not be created!
After I changed permissions to 777, all jobs started to execute as expected.
So, I have two suggestions... either one you find more convenient:
1. Make sure that temporary files are created under JENKINS_HOME/tmp, not /tmp;
2. Perform sanity checks just after installation and after a configuration screen which stresses all known configuration issues, etc... telling the user that something needs to be remediated.
問題是說跷坝,因為jenkins這個用戶沒有權限讀取/tmp
酵镜,我之前看錯誤也知道是權限問題,可是不知道是哪個目錄柴钻,哪個文件淮韭,什么地方的權限問題。這里說是/tmp
目錄眼前一亮贴届。
我們看下原有的權限吧靠粪;
drwx------ 3 root root 4096 Oct 12 21:17 tmp
很明顯jenkins用戶沒有權限。我們改 /tmp
的權限吧毫蚓。
chown jenkins /tmp/
修改完的結果如下:
drwx------ 5 jenkins root 4096 Oct 12 21:45 tmp
好了占键,我們測試下,結果有效元潘。問題解決了畔乙。希望以后的同學遇到了,能搜索到這個文章翩概,快速解決問題牲距,少花費些時間。