Gradle 4 - replacing deprecated Test::testClassesDir


(Dimitar Dimitrov) #1

When replacing this deprecated method, which shall we prefer:

  testClassesDirs = files(sourceSets.integrationTest.output.classesDir)

or

  testClassesDirs = sourceSets.integrationTest.output

Strictly speaking, the latter will also bring the resources into the classpath. Is that a good thing?


(Sterling Greene) #2

Neither :slight_smile:

testClassesDirs = sourceSets.integrationTest.output.classesDirs

If you used multiple languages for the same source set, they could use separate output directories.


(Dimitar Dimitrov) #3

Would be nice going forward to have the typical replacements mentioned in the deprecated methods javadoc.


(Michael Vorburger) #4

I had a similar problem when bumping from an old Gradle 2.10 to current 5.2.1 :

task integrationTest(type:Test) {
    testClassesDir = project.sourceSets.integrationTest.output.classesDir

Could not get unknown property ‘classesDir’ for integration test classes of type org.gradle.api.internal.tasks.DefaultSourceSetOutput.

And this fixed it:

testClassesDirs = project.sourceSets.integrationTest.output.classesDirs