jmq
jmq

Reputation: 10370

Fixing A Gradle dependsOn Deprecation Warning

I upgraded my build environment to the most recent version of gradle (1.0-rc3). I'm receiving the following deprecation warning:

"The Project.dependsOn(String path) method has been deprecated"

I fixed all of my task dependsOn references to use the object references, but I do not know how to fix the dependsOn references for multiproject Projects. I have a project that depends on another project. This is the definition at the top of the build.gradle script:

dependsOn(':projects/arch/application')

How do I convert this string reference to an object reference to the project? I looked through the gradle documentation, but it still references the deprecated string syntax (link below).

http://www.gradle.org/docs/current/userguide/multi_project_builds.html

This syntax works today, but the deprecation warning is telling me it will not in the future. How do I fix this?

Upvotes: 2

Views: 1641

Answers (1)

Peter Niederwieser
Peter Niederwieser

Reputation: 123950

The deprecation warning isn't about changing String references to Object references (there isn't even a Project.dependsOn() method that accepts an Object). It's about giving up on Project.dependsOn() and only using Task.dependsOn().

In Gradle, execution dependencies are always between tasks. Project.dependsOn() was a way to add a task dependency from every task in project A to the equally named task in project B (if it exists). Practice showed that this feature has little value and is often misunderstood, hence the deprecation.

Upvotes: 4

Related Questions