Cause: No such property: sourceSets for class: org.gradle.api.plugins.Convention
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
Ca开发者_运维技巧use: No such property: sourceSets for class: org.gradle.api.plugins.Convention
i am using Gradle 0.9-rc-3
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();
}
}
}
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() }
}
精彩评论