Given this gradle.build as root project
apply plugin: 'java'
allprojects {
task bla() {
println project.name
println project.sourceSets.main.allSource.srcDirs
println sourceSets.main.allSource.srcDirs
}
}
with this settings.gradle:
include 'subproj'
and this gradle.build for the subproject:
apply plugin: 'java'
When i execute “gradle bla” I would expect to get the different locations of the projects as output. Instead I get:
gradlemulti [D:\Daten\gradlemulti\src\main\resources, D:\Daten\gradlemulti\src\main\java] [D:\Daten\gradlemulti\src\main\resources, D:\Daten\gradlemulti\src\main\java] subproj [D:\Daten\gradlemulti\src\main\resources, D:\Daten\gradlemulti\src\main\java] [D:\Daten\gradlemulti\src\main\resources, D:\Daten\gradlemulti\src\main\java]
If I copy the code of the bla task in each build.gradle everything works as expected. This of course robs me of the nice allprojects feature. How can I fix this and still use the allprojects script block?