"The distsDir method has been deprecated", but we're not even using it

We get the warnings:
“The distsDir method has been deprecated.”
“The libsDir method has been deprecated.”

But the line of code contains references to neither:

version = properties['project.version']

The stack trace:

    at org.gradle.api.plugins.internal.DefaultBasePluginConvention.getDistsDir(DefaultBasePluginConvention.java:60)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at groovy.lang.MetaBeanProperty.getProperty(MetaBeanProperty.java:59)
    at org.gradle.internal.extensibility.DefaultConvention$ExtensionsDynamicObject.getProperties(DefaultConvention.java:256)
    at org.gradle.groovy.scripts.BasicScript$ScriptDynamicObject.getProperties(BasicScript.java:114)
    at org.gradle.groovy.scripts.BasicScript.getProperties(BasicScript.java:73)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at groovy.lang.MetaBeanProperty.getProperty(MetaBeanProperty.java:59)
    at org.gradle.groovy.scripts.BasicScript$ScriptDynamicObject.tryGetProperty(BasicScript.java:141)
    at org.gradle.groovy.scripts.BasicScript.getProperty(BasicScript.java:64)
    at build.run(/.../acme/build.gradle:13)
    (omitting caller stack trace)

Best I can tell, I ask for the property “project.version”, but it is somehow looking up “distsDir” instead, and then proceeds to complain about my script using deprecated stuff, when it’s Gradle internal logic using the deprecated stuff.

Is this just a bug? I’m running Gradle 5.2.1.

distsDir is so widely used in our project… I’m not understanding what we are supposed to replace it with.


Is it preferable now that we hardcode that string everywhere?

The docs don’t say what to replace it with (which is a problem too - anything deprecated should say what to do instead!) but it does say what it defaults to anyway, so you could just use that ("${project.buildDir}/${project.distsDirName}") and neither of those appear to be deprecated.

Doesn’t help my situation though, because I’m not the one calling it in the first place - Gradle seems to be calling it internally.

Thanks, that’s useful. But I’m still baffled as to why distsDir and libDir as file objects would be deprecated in favour of relative string path names. Surely file objects are vastly more useful.

What is the thinking of the gradle team here?

Yeah, I agree. The change they were removed in was doing something else entirely - making some properties in the archive tasks lazy - and didn’t seem to require deprecating the properties over in this location.

Maybe the plan was to add back distsDir with a different type in 6.0, but still, in other places where I’ve seen that happen, the new lazy property got a different name. :confused:

Hey folks,

For the sake of clarity, Gradle 6.0 introduced libsDirectory and distsDirectory on the base convention.
In Gradle 7.1, a base extension is added, having those properties as well, since conventions are entering a deprecation / removal cycle.
This should be transparent for build authors though.

(Information posted on the linked issue as well)