Reputation: 21
please help me getting error?
Could not get unknown property 'classesDir' for main classes of type org.gradle.api.internal.tasks.DefaultSourceSetOutput.
Open File
I Codes
task dist(type: Jar) {
from files(sourceSets.main.output.classesDir)
from files(sourceSets.main.output.resourcesDir)
from {configurations.compile.collect {zipTree(it)}}
from files(project.assetsDir);
manifest {
attributes 'Main-Class': project.mainClassName
}
}
Upvotes: 2
Views: 2651
Reputation: 27996
Duplicate of this issue
SourceSetOutput.getClassesDir() was deprecated in Gradle 4 and removed in Gradle 5. Please use getClassesDirs() in Gradle 5
In your instance, the problem is with
sourceSets.main.output.classesDir
Change it to
sourceSets.main.output.classesDirs
Also, you can omit most of the files(...)
calls in your task definition as most of the Jar
tasks methods accept Object
. Eg:
task dist(type: Jar) {
from sourceSets.main.output.classesDirs
from sourceSets.main.output.resourcesDir
from {configurations.compile.collect {zipTree(it)}}
from project.assetsDir
manifest {
attributes 'Main-Class': project.mainClassName
}
}
Upvotes: 2