【发布时间】:2017-06-15 04:57:30
【问题描述】:
我在安装了brew install gradle 的 MacOS X 10.12.1 上运行 Gradle 3.2.1,我自己没有设置任何环境变量等,尝试使用 Java 9 EA:
gradle build -Dorg.gradle.java.home=~/jdk-9.jdk/Contents/Home
但是构建失败了
FAILURE:构建失败并出现异常。
- 出了什么问题:无法启动守护进程。此问题可能是由于守护程序配置不正确造成的。例如, 使用了无法识别的 jvm 选项。
据我所知,它失败是因为守护进程正在尝试使用 maxpermsize JVM 选项(Java 8+ 不支持该选项,但在 Java 8 中它只是一个警告)。
所以我尝试禁用守护进程:
mkdir -p ~/.gradle && echo "org.gradle.daemon=false" >> ~/.gradle/gradle.properties
但gradle build 仍在尝试启动守护进程...我在项目目录中删除了~/.gradle 和.gradle。还有其他想法吗?
$ gradle build -Dorg.gradle.daemon=false -Dorg.gradle.java.home=/Library/Java/JavaVirtualMachines/jdk-9.jdk/Contents/Home
To honour the JVM settings for this build a new JVM will be forked. Please consider using the daemon: https://docs.gradle.org/3.2.1/userguide/gradle_daemon.html.
FAILURE: Build failed with an exception.
* What went wrong:
Unable to start the daemon process.
This problem might be caused by incorrect configuration of the daemon.
For example, an unrecognized jvm option is used.
Please refer to the user guide chapter on the daemon at https://docs.gradle.org/3.2.1/userguide/gradle_daemon.html
Please read the following process output to find out more:
-----------------------
FAILURE: Build failed with an exception.
* What went wrong:
java.lang.ExceptionInInitializerError (no error message)
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
> Starting Daemon%
【问题讨论】:
-
是否设置了 GRADLE_OPTS 环境变量?还有 GRADLE_USER_HOME 变量影响 gradle 查找属性文件的位置...? docs.gradle.org/current/userguide/gradle_daemon.html
-
@Adam 这些变量都没有设置