Port code snippet with testClassesDirs from gradle 4.0 to gradle 3.1


(Sergey Sheypak) #1

Hi, I’m using gradle 3.1 and gradle play plugin. I have to add task
Can you help me to port snippet from 4.0 to 3.1
Thank you. I can’t find analoguous property “testClassesDirs” in 3.1 gradle…

task doesnotWorkIn3_1(type: Test) {

    dependsOn { tasks.compilePlayBinaryTests }
    // this one property not known in gradle 3.1... works only in 4.0 can find similar thing in 3.1
    testClassesDirs = project.files { [tasks.compilePlayBinaryTests.destinationDir] }
    classpath = project.files { testPlayBinary.classpath }
    include '**/SwaggerControllerJsonTest.class'
    outputs.upToDateWhen { false }
}

(Pierre) #2

Hi,

Can you try with testClassesDir?

task doesnotWorkIn3_1(type: Test) {

    dependsOn { tasks.compilePlayBinaryTests }
    // Note that the following property is deprecated with Gradle 4.0
    testClassesDir = tasks.compilePlayBinaryTests.destinationDir
    classpath = project.files { testPlayBinary.classpath }
    include '**/SwaggerControllerJsonTest.class'
    outputs.upToDateWhen { false }
}