下載好gradle並配置好環境變量後,使用gradle -v
測試,報錯如下:
[yan@yanwei ~]$ gradle -v
FAILURE: Build failed with an exception.
* What went wrong:
Failed to load native library 'libnative-platform.so' for Linux amd64.
* 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
這是權限問題,默認的GRADLE_USER_HOME
在當前用戶目錄~/.gradle/
下,而我指定的是/usr/local/repository
,並且這個目錄歸root:root
所有,當前(非root)用戶無權寫入,所以報錯了。修改權限即可。
參考
https://community.bitnami.com/t/gradle-doesnt-work-libnative-platform-so/40686