如何控制gradle守护进程的输出

时间:2013-06-12 18:53:19

标签: gradle gradle-daemon

我正在我的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秒,但这比原始消息更令人讨厌!如何摆脱原始消息或摆脱所有这些日志记录输出,以便输出恢复正常?

2 个答案:

答案 0 :(得分:7)

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

<强>〜/ .gradle / gradle.properties:

org.gradle.daemon=true

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

答案 1 :(得分:0)

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

  • /home/username/.gradle/(Linux)
  • /Users/username/.gradle/(Mac)
  • C:\ Users \ username \ .gradle \(Windows)

将此行添加到文件中:

  

org.gradle.daemon =真