When I enable the groovy support in an empty new project I just get the error:
Could not set unknown property 'classesDir' for main classes of type org.gradle.api.internal.tasks.DefaultSourceSetOutput.
When I enable the groovy support in an empty new project I just get the error:
Could not set unknown property 'classesDir' for main classes of type org.gradle.api.internal.tasks.DefaultSourceSetOutput.
The issue reproduces with Gradle 5.4.1.
Seems that SourceSetOutput.classesDir property was removed in Gradle 5. It was deprecated in version 4.10.3
@tsarev, could you take a look?
It seems that you’re using Gradle 5. They’ve removed this property and replaced by getter classesDirs
- Migration to Gradle 5.
There is a workaround:
sourceSets {
main {
groovy { srcDirs = ["src"] }
java.outputDir = new File(project.buildDir, "classes/main")
groovy.outputDir = new File(project.buildDir, "classes/main")
}
test {
groovy { srcDirs = ["test"] }
java.outputDir = new File(project.buildDir, "classes/test")
groovy.outputDir = new File(project.buildDir, "classes/test")
}
}
sourceSets.main.output.classesDirs.setFrom(new File(project.buildDir, "classes/main"))
sourceSets.test.output.classesDirs.setFrom(new File(project.buildDir, "classes/test"))
Regards,
Daniil