I can’t figure out why the order of ext {} matters and causes a failure such as below? Without an example to copy, how are you guys figuring the order to put things? The docs seem to just talk about the closures in isolation and not interdependencies between them ?
project-base
settings.gradle
build.gradle (inside this one in examples below)
subproject_folder
build.gradle
ext {} // this blows up here
buildscript {}
plugins {}
sonarqube {}
allprojects {}
subprojects {}
but if I have the same thing except
buildscript {}
plugins {}
sonarqube {}
allprojects {}
subprojects {}
ext {} // bingo all of a sudden this is legal ?
The specific order of the ext block doesn’t matter here as long as you don’t violate the rules imposed by the plugins block.
The plugins block must be at the top and can only be preceded by the buildscript block. Both plugins and buildscript contribute to the classpath of the build script itself. Therefore, they must be compiled and executed before the rest of the script. That result is then used to compile and execute the rest of the file.