gradle build使用Retrolambda在jenkins上失败

时间:2015-06-01 15:12:02

标签: android jenkins gradle retrolambda

android build在jenkins上失败,同时在本地成功运行,下面是构建输出:

:app:compileDebugJavaNote: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.

advice defined in hugo.weaving.internal.Hugo has not been applied [Xlint:adviceDidNotMatch]
:app:compileRetrolambdaDebugobjc[91376]: Class JavaLaunchHelper is implemented in both /Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/Home/bin/java and /Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/Home/jre/lib/libinstrument.dylib. One of the two will be used. Which one is undefined.
 FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:compileRetrolambdaDebug'.
> Process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/Home/bin/java'' finished with non-zero exit value 1

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

2 个答案:

答案 0 :(得分:0)

有两个enviroment_variables指向不同的JRE(Java运行时环境)。 詹金斯不知道他应该使用哪一种。

可能你已经在Jenkins设置了一个enviroment_variable,在哪里找到一个JRE。 但与此同时,jenkins运行的操作系统也有一个enviroment_variable,指向其他位置可以找到JRE。

由你决定删除哪一个。

答案 1 :(得分:0)

尝试通过两个步骤构建您的项目:

./gradlew prepareDebugDependencies
./gradlew assembleDebug

有关原因的讨论,请参阅https://github.com/evant/gradle-retrolambda/issues/105

另外(也许对其他人有帮助),请确保您已设置类似于此的环境变量:

export JAVA7_HOME=/usr/lib/jvm/java-7-oracle
export JAVA8_HOME=/usr/lib/jvm/java-8-oracle
export JAVA_HOME=$JAVA7_HOME