The DefaultSourceDirectorySet constructor has been deprecated

I start to test Gradle 5.0.rc-4 with Kotlin 1.3.10 with the sample found here:

I changed the


to be

and the

build.gradle.kts plugins of Kotlin to be 1.3.10

When I execute

./gradlew build

it successfully build but with this

Configure project :
The DefaultSourceDirectorySet constructor has been deprecated. This is scheduled to be removed in Gradle 6.0. Please use the ObjectFactory service to create instances of SourceDirectorySet instead.

How I use ObjectFactory here?


I can’t see any references to DefaultSourceDirectorySet in the hello-kotlin project you linked to (note: I’ve not yet tried kotlin myself)

If you specify --stacktrace at command line it should give a stack trace for the deprecation.

Yes @Lance, there isn’t any DefaultSourceDirectorySet in the example, but even when created the project using gradle init command and try to build the default generated Hello Kotlin project, it give that Warning.

Yes, and I suspect that the call to DefaultSourceDirectorySet constructor is somewhere deeper in your stack (possibly in kotlin-dsl?). I suggest that you specify --stacktrace at command line to identify the culprit.

When I use --scan it give me two deprecated , it appears in the plugins:
id("org.jetbrains.kotlin.jvm") version "1.3.10"

It’s appear kotlin jvm gradle plugin still use DefaultSourceDirectorySet

Sorry, I can’t at this time use --stack trace

It’s --stacktrace

See Gradle CLI

Yes, looks like kotlin-dsl is invoking the DefaultSourceDirectorySet constructor via reflection