Cause: No such property: sourceSets for class: org.gradle.api.plugins.Convention
-
10-10-2019 - |
문제
i have run a code snippet from Gradle Cookbook
apply plugin: 'java'
task "create-dirs" << {
convention.sourceSets.all*.java.srcDirs*.each { it.mkdirs() }
convention.sourceSets.all*.resources.srcDirs*.each { it.mkdirs() }
}
when i run i am getting following error
Cause: No such property: sourceSets for class: org.gradle.api.plugins.Convention
i am using Gradle 0.9-rc-3
해결책 2
Ok sorry. i got it
it must be
apply plugin: 'java'
task "create-dirs" << {
sourceSets.all*.java.srcDirs*.each { it.mkdirs() }
sourceSets.all*.resources.srcDirs*.each { it.mkdirs() }
}
다른 팁
The property all has been removed now ,So you can do it as:
task "create-dirs" {
def defaultPackage = "org.akash.gradle";
['java', 'groovy', 'resources'].each { String dir ->
sourceSets*."$dir".srcDirs*.each { dir1 ->
def newDir = new File(dir1, defaultPackage);
newDir.mkdirs();
}
}
}
제휴하지 않습니다 StackOverflow