ProfileListener no longer receives events unless --profile is specified

Gradle 2.9 has changed the behavior of Gradle profiling. We depended on ProfileListener being called, so we could capture build performance data, without requiring that all Gradle invocations include --profile. Could this please be considered for 2.10, it’s blocking us from upgrading to Gradle 2.9 as it’s not possible to enable profiling programatically.

commit 81024e422c3fec814bcdd626bbc56789b67fdcb9
Author: Lari Hotari <>
Date:   Tue Sep 22 18:12:37 2015 -0400

    register ProfileEventAdapter only when profiling is enabled

diff --git a/subprojects/core/src/main/groovy/org/gradle/initialization/ b/subprojects/core/src/main/groovy/org/gradle/initialization/
index 7c8d5a0..b8f513d 100644
--- a/subprojects/core/src/main/groovy/org/gradle/initialization/
+++ b/subprojects/core/src/main/groovy/org/gradle/initialization/
@@ -125,8 +125,8 @@ public class DefaultGradleLauncherFactory implements GradleLauncherFactory {

-        listenerManager.addListener(serviceRegistry.get(ProfileEventAdapter.class));
         if (startParameter.isProfile()) {
+            listenerManager.addListener(serviceRegistry.get(ProfileEventAdapter.class));
             listenerManager.addListener(new ReportGeneratingProfileListener());
         ScriptUsageLocationReporter usageLocationReporter = new ScriptUsageLocationReporter();

Thanks for the feedback. The commit has been reverted for 2.10 .

Awesome, thanks Lari.

To avoid future breakages in your plugin, you might want to register your own set of BuildListener, ProjectEvaluationListener and TaskExecutionListener. Would these public interfaces capture all the metrics you need?