I have a multi project build where almost all the configuration is located in the root build.gradle file. So my subprojects only contain special stuff like, adding non-standard tasks to the build where necessary. This works, because the subprojects build.gradle won’t get evaluated before root finishes, so all configurations, tasks, dependencies are set and can be used.
but the addition of one single line destroys my entire concept:
configurations.compile.files
as this will resolve the configuration, AND to my surprise will result in the subprojects included in the configuration to be evaluated to early.
Is there a way to avoid that?
For clarification an example settings.gradle:
include 'foo'
build.gradle:
allprojects {
apply plugin: ‘java’
}
dependencies {
compile project(’:foo’)
}
println “before resolve”
configurations.compile.files.each {println it}
println “after resolve”
foo/build.gradle:
println "foo"
actual output:
before resolve
foo
/foo/build/libs/foo.jar
after resolve
expected output:
before resolve
/foo/build/libs/foo.jar # wouldn’t mind not having this path if projectDependency not configured yet.
after resolve
foo