Any way to get cause(s) of DSL deprecation messages?

Everytime we upgrade Gradle versions we end up with warning messages about DSL deprecations. Quite often the source of these warnings are plugins we are using.

For example, I am sitting here trying to go from 1.5->1.6 and am seeing:

The ConfigurationContainer.add() method has been deprecated and is scheduled to be removed in Gradle 2.0. Please use the create() method instead.
The TaskContainer.add() method has been deprecated and is scheduled to be removed in Gradle 2.0. Please use the create() method instead.

Our build scripts do not use these methods directly. I have gone through all our custom plugins and eliminated them. But still the warnings are there. So how can I find the code using them?

Hello Steve, to trace the root cause for a deprecation warning, you can run your build with the systemproperty “org.gradle.deprecation.trace”. This gives you a stracktrace for the warning in the stdout.

cheers, René

Hi Rene,

Probably I am just misunderstanding you…

running ‘gradle -D"org.gradle.deprecation.trace" generatePomFileForMavenJavaPublication’ does not output anything extra

It’s ‘-Dorg.gradle.deprecation.trace=true’.

I also get these warnings and I added -Dorg.gradle.deprecation.trace=true

The TaskContainer.add() method has been deprecated and is scheduled to be removed in Gradle 2.0. Please use the create() method instead.

org.gradle.util.SingleMessageLogger.logTraceIfNecessary(SingleMessageLogger.java:183)

org.gradle.util.SingleMessageLogger.nagUserWith(SingleMessageLogger.java:140)

org.gradle.util.SingleMessageLogger.nagUserOfReplacedMethod(SingleMessageLogger.java:102)

org.gradle.api.internal.tasks.DefaultTaskContainer.add(DefaultTaskContainer.java:90)

org.gradle.api.tasks.TaskContainer$add.call(Unknown Source)

eu.appsatori.gradle.fatjar.FatJarPlugin.apply(FatJarPlugin.groovy:68)

eu.appsatori.gradle.fatjar.FatJarPlugin.apply(FatJarPlugin.groovy)

org.gradle.api.internal.plugins.DefaultPluginContainer.providePlugin(DefaultPluginContainer.java:107)

org.gradle.api.internal.plugins.DefaultPluginContainer.addPluginInternal(DefaultPluginContainer.java:71)

org.gradle.api.internal.plugins.DefaultPluginContainer.apply(DefaultPluginContainer.java:37)

org.gradle.api.plugins.PluginContainer$apply$0.call(Unknown Source)

org.gradle.api.plugins.gae.GaePlugin.applyFatJarPlugin(GaePlugin.groovy:129)

org.gradle.api.plugins.gae.GaePlugin.this$2$applyFatJarPlugin(GaePlugin.groovy)

org.gradle.api.plugins.gae.GaePlugin$this$2$applyFatJarPlugin.callCurrent(Unknown Source)

org.gradle.api.plugins.gae.GaePlugin.apply(GaePlugin.groovy:84)

org.gradle.api.plugins.gae.GaePlugin.apply(GaePlugin.groovy)

org.gradle.api.internal.plugins.DefaultPluginContainer.providePlugin(DefaultPluginContainer.java:107)

org.gradle.api.internal.plugins.DefaultPluginContainer.addPluginInternal(DefaultPluginContainer.java:71)

org.gradle.api.internal.plugins.DefaultPluginContainer.apply(DefaultPluginContainer.java:37)

org.gradle.api.internal.plugins.DefaultObjectConfigurationAction.applyPlugin(DefaultObjectConfigurationAction.java:101)

org.gradle.api.internal.plugins.DefaultObjectConfigurationAction.access$200(DefaultObjectConfigurationAction.java:32)

org.gradle.api.internal.plugins.DefaultObjectConfigurationAction$3.run(DefaultObjectConfigurationAction.java:72)

org.gradle.api.internal.plugins.DefaultObjectConfigurationAction.execute(DefaultObjectConfigurationAction.java:114)

org.gradle.api.internal.project.AbstractPluginAware.apply(AbstractPluginAware.java:39)

org.gradle.api.Project$apply.call(Unknown Source)

org.gradle.api.internal.project.ProjectScript.apply(ProjectScript.groovy:34)

org.gradle.api.Script$apply.callCurrent(Unknown Source)

build_3j66a5565dn8vi8ir0sr75i7rt.run(/Users/gunnar/git/Davinci/build.gradle:5)

org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:52)

org.gradle.configuration.DefaultScriptPluginFactory$ScriptPluginImpl.apply(DefaultScriptPluginFactory.java:127)

org.gradle.configuration.BuildScriptProcessor.execute(BuildScriptProcessor.java:36)

org.gradle.configuration.BuildScriptProcessor.execute(BuildScriptProcessor.java:23)

org.gradle.configuration.ConfigureActionsProjectEvaluator.evaluate(ConfigureActionsProjectEvaluator.java:34)

org.gradle.configuration.LifecycleProjectEvaluator.evaluate(LifecycleProjectEvaluator.java:55)

org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProject.java:465)

org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProject.java:76)

org.gradle.configuration.DefaultBuildConfigurer.configure(DefaultBuildConfigurer.java:31)

org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:142)

org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:113)

org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:81)

org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.run(InProcessBuildActionExecuter.java:64)

org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:33)

org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:24)

org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:35)

org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:26)

org.gradle.launcher.cli.RunBuildAction.run(RunBuildAction.java:50)

org.gradle.api.internal.Actions$RunnableActionAdapter.execute(Actions.java:171)

org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:201)

org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:174)

org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:170)

org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:139)

org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33)

org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22)

org.gradle.launcher.Main.doAction(Main.java:48)

org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45)

org.gradle.launcher.Main.main(Main.java:39)

org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:50)

org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:32)

org.gradle.launcher.GradleMain.main(GradleMain.java:26)

That fatjar plugin needs to be updated:

eu.appsatori.gradle.fatjar.FatJarPlugin.apply(FatJarPlugin.groovy:68)