are there gradlew or gradle caches on linux?

时间:2015-06-25 19:14:28

标签: java android jenkins gradle gradlew

Are there caches or other environment files that can cause gradle to throw this error? Exception in thread "main" java.lang.NullPointerException at org.gradle.wrapper.BootstrapMainStarter.findLauncherJar(BootstrapMainStarter.java:34) at org.gradle.wrapper.BootstrapMainStarter.start(BootstrapMainStarter.java:25) at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:127) at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:58) I'm building a Jenkins CI server for building android apps. The Jenkins master passes the job off to an AWS linux slave, where it Wipes the previous workspace Downloads the github repo moves into the project folder ./gradlew clean build Then it throws the exception above. Other repos using ./gradlew build on this machine. This repo built prior to: adding additional disk space to the machine and downloading more android SDKs, neither of which should affect gradlew. Attempting to build the exact repo that built, with the same configuration that built still throws the same exception. I added echoes to the gradlew file to see where the problem happens, and all of them sound prior to the final line: exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" What do I need to do to make this build?

2 个答案:

答案 0 :(得分:0)

这需要一些狩猎,但这是我找到的解决方案。 Jenkins(默认情况下)无权访问$ PATH或任何默认应用程序(因此计算机可以运行Ruby 2.2,例如,您的CI作业可以运行Ruby 1.0) 如果您查看导致错误的脚本,那是因为它调用了一个调用脚本ect的脚本,直到某个级别(我想说7)它调用diff函数。因为这个依赖关系的编写是假设您的UNIX框知道应用程序中的烘焙。因为调用此函数的Jenkins用户不知道该二进制文件是否存在,以及整个脚本的编写方式,所以它会抛出上面的异常。 希望这有帮助

答案 1 :(得分:-1)

必须弄乱你的gradle包装设置。我强烈推荐Jenkins Gradle Plugin。它使我的gradle构建变得微不足道。如果build.gradle不在根工作空间中,则可以指定该路径的任何路径。