Ubantu Jenkins打包部署二:專案配置
阿新 • • 發佈:2018-12-20
打包過程發生錯誤。不能建立資料夾。
錯誤資訊如下。
14:40:18.864 [DEBUG] [org.gradle.model.internal.registry.DefaultModelRegistry] Project :app - Registering model element 'tasks.transformClassesWithDexForAgent127Cdeljianshe' (hidden = false) 14:40:18.865 [DEBUG] [org.gradle.model.internal.registry.DefaultModelRegistry] Project :app - Registering model element 'tasks.packageAgent127Cdeljianshe' (hidden = false) 14:40:18.865 [QUIET] [system.out] 14:40:18.866 [QUIET] [system.out] watchTimeConsume disabled 14:40:18.866 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 14:40:18.866 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] FAILURE: Build failed with an exception. 14:40:18.866 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 14:40:18.866 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * What went wrong: 14:40:18.866 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] A problem occurred configuring project ':app'. 14:40:18.866 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] > Cannot create directory /home/t1/jenkins/workspace/accmobile-git/app/build/intermediates/incremental/packageAgent127Cdeljianshe/zip-cache 14:40:18.866 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 14:40:18.866 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * Exception is: 14:40:18.867 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] org.gradle.api.ProjectConfigurationException: A problem occurred configuring project ':app'. 14:40:18.867 [ERROR] [org.gradle.internal.buildevents.
原因:建立檔案失敗。是因為許可權不足。
[email protected]:/home/t1/jenkins/workspace/accmobile-git/app# ll total 80 drwxrwxrwx 7 jenkins jenkins 4096 11月 9 13:08 ./ drwxrwxrwx 13 jenkins jenkins 4096 11月 9 14:26 ../ -rwxrwxrwx 1 jenkins jenkins 25702 11月 9 11:24 app.iml*drwxr-xr-x 7 root root 4096 11月 9 13:09 build/
解決方法:將目錄資料夾的所有者和使用者組設定為jenkins。
$ sudo chown -R jenkins build
$ sudo chgrp -R jenkins build
[email protected]:/home/t1/jenkins/workspace/accmobile-git/app# ll
total 80
drwxrwxrwx 7 jenkins jenkins 4096 11月 9 13:08 ./
drwxrwxrwx 13 jenkins jenkins 4096 11月 9 14:26 ../
-rwxrwxrwx 1 jenkins jenkins 25702 11月 9 11:24 app.iml*
drwxr-xr-x 7 jenkins jenkins 4096 11月 9 13:09 build/
-rw-r--r-- 1 jenkins jenkins 6757 11月 9 11:44 build.gradle
drwxrwxrwx 3 jenkins jenkins 4096 11月 9 10:43 E:/
-rw-r--r-- 1 jenkins jenkins 8 11月 9 11:44 .gitignore
drwxrwxrwx 2 jenkins jenkins 4096 11月 9 11:44 keystore/
drwxrwxrwx 2 jenkins jenkins 4096 11月 9 11:44 libs/
-rw-r--r-- 1 jenkins jenkins 9245 11月 9 11:44 proguard-rules.pro
drwxrwxrwx 7 jenkins jenkins 4096 11月 8 10:31 src/
修改完成後。app/build所有者變為jenkins了。