3

我在我的 gradle 构建中设置 jvm args,它给了我这个有点烦人的消息:

Note: in order to honour the org.gradle.jvmargs and/or org.gradle.java.home values specified for this build, it is necessary to fork a new JVM.
To avoid the slowdown associated with this extra process, you might want to consider running Gradle with the daemon enabled.
Please see the user guide chapter on the daemon at /Users/gus/tools/gradle-1.4/docs/userguide/gradle_daemon.html.
:compileJava UP-TO-DATE
:processResources UP-TO-DATE
:classes UP-TO-DATE

所以想让消息消失,我试过了gradle --daemon。然后我被一大堆看起来像这样的垃圾邮件击中:(小节选)

14:33:35.248 [DEBUG] [org.gradle.launcher.daemon.client.DaemonClientConnection] thread 1: dispatching class org.gradle.launcher.daemon.protocol.Build
14:33:35.287 [DEBUG] [org.gradle.launcher.daemon.client.DaemonClientConnection] thread 1: received class org.gradle.launcher.daemon.protocol.BuildStarted
14:33:35.298 [DEBUG] [org.gradle.launcher.daemon.client.DaemonClientConnection] thread 1: received class org.gradle.logging.internal.ProgressStartEvent
14:33:35.316 [DEBUG] [org.gradle.launcher.daemon.client.DaemonClientConnection] thread 1: received class org.gradle.logging.internal.ProgressStartEvent
14:33:35.319 [DEBUG] [org.gradle.launcher.daemon.client.DaemonClientConnection] thread 1: received class org.gradle.logging.internal.ProgressCompleteEvent
14:33:35.321 [DEBUG] [org.gradle.launcher.daemon.client.DaemonClientConnection] thread 1: received class org.gradle.logging.internal.ProgressStartEvent
14:33:35.322 [DEBUG] [org.gradle.launcher.daemon.client.DaemonClientConnection] thread 1: received class org.gradle.logging.internal.ProgressCompleteEvent
14:33:35.444 [DEBUG] [org.gradle.launcher.daemon.client.DaemonClientConnection] thread 1: received class org.gradle.logging.internal.ProgressCompleteEvent
14:33:35.446 [DEBUG] [org.gradle.launcher.daemon.client.DaemonClientConnection] thread 1: received class org.gradle.logging.internal.ProgressStartEvent
14:33:35.447 [DEBUG] [org.gradle.launcher.daemon.client.DaemonClientConnection] thread 1: received class org.gradle.logging.internal.ProgressStartEvent
14:33:35.444 [LIFECYCLE] [org.gradle.TaskExecutionLogger] :compileJava
14:33:35.479 [DEBUG] [org.gradle.launcher.daemon.client.DaemonClientConnection] thread 1: received class org.gradle.logging.internal.ProgressStartEvent
14:33:35.649 [DEBUG] [org.gradle.launcher.daemon.client.DaemonClientConnection] thread 1: received class org.gradle.logging.internal.ProgressCompleteEvent
14:33:35.728 [DEBUG] [org.gradle.launcher.daemon.client.DaemonClientConnection] thread 1: received class org.gradle.logging.internal.ProgressCompleteEvent
14:33:35.727 [LIFECYCLE] [org.gradle.TaskExecutionLogger] :compileJava UP-TO-DATE
14:33:35.731 [DEBUG] [org.gradle.launcher.daemon.client.DaemonClientConnection] thread 1: received class org.gradle.logging.internal.ProgressStartEvent
14:33:35.727 [LIFECYCLE] [org.gradle.TaskExecutionLogger] :processResources
14:33:35.736 [DEBUG] [org.gradle.launcher.daemon.client.DaemonClientConnection] thread 1: received class org.gradle.logging.internal.ProgressCompleteEvent
14:33:35.735 [LIFECYCLE] [org.gradle.TaskExecutionLogger] :processResources UP-TO-DATE
14:33:35.739 [DEBUG] [org.gradle.launcher.daemon.client.DaemonClientConnection] thread 1: received class org.gradle.logging.internal.ProgressStartEvent
14:33:35.736 [LIFECYCLE] [org.gradle.TaskExecutionLogger] :classes

它快了大约 3 秒,但这比原来的消息更烦人!如何摆脱原始消息或摆脱所有这些日志输出以使输出恢复正常?

4

2 回答 2

8

我没有看到任何这样的输出。我已经使用属性文件方法启用了守护进程,也许这就是为什么?

~/.gradle/gradle.properties:

org.gradle.daemon=true

gradle --no-daemon如果您决定一个特定的执行应该忽略它,您总是可以使用它。

于 2013-06-12T20:37:06.933 回答
0

实际上添加守护进程的方法对于以下操作系统是类似的。对于以下每个操作系统,在以下目录中创建一个名为“gradle.properties”的文件:

  • /home/用户名/.gradle/ (Linux)
  • /Users/用户名/.gradle/ (Mac)
  • C:\Users\用户名\.gradle\ (Windows)

将此行添加到文件中:

org.gradle.daemon=true

于 2015-06-14T14:06:27.020 回答