Slackbot
06/01/2022, 2:50 PMChris Lee
06/01/2022, 2:53 PMsubprojects
is an anti-pattern; it couples projects together, resulting in limitations for parallel execution, configuration cache, etc. It’s cleanest to apply plugins in each project (as required for that project), or create convention plugin(s) that apply plugins / apply standard configuration (and apply those convention plugins in your projects).
Plugins are applied project-by-project - they aren’t inherited from the root project.Eugen Mayer
06/01/2022, 2:55 PMEugen Mayer
06/01/2022, 2:55 PMapply false
is needed to stop the inheritance (explicitly)Chris Lee
06/01/2022, 2:57 PMEugen Mayer
06/01/2022, 3:00 PMplugins{}
is automatically applied (in the docs there is the section Where «plugin id» and «plugin version» must be constant, literal, strings and the apply statement with a boolean can be used to disable the default behavior of applying the plugin immediately (e.g. you want to apply it only in subprojects). No other statements are allowed; their presence will cause a compilation error.
under https://docs.gradle.org/current/userguide/plugins.html#plugins_dsl_limitationsEugen Mayer
06/01/2022, 3:01 PMChris Lee
06/01/2022, 3:02 PMSteve Ebersole
06/01/2022, 3:03 PMplugins {}
, the plugins are applied very early. Using apply:
they are applied depending on their position in the build file. obviously prefer plugins {}
Eugen Mayer
06/01/2022, 3:04 PMapply true
does mean 'apply on the project i'am define in' (so in our case, the root project. apply false
then means, do declare (load into the classpath) but not apply. The latter is used to ensure all subproject can load (from classpath) without defining a custom version (so all subproject use the same version of a plugin)Steve Ebersole
06/01/2022, 3:04 PMEugen Mayer
06/01/2022, 3:05 PMSteve Ebersole
06/01/2022, 3:05 PMapply from: project.file( "some/build/file.gradle" )
Eugen Mayer
06/01/2022, 3:05 PMChris Lee
06/01/2022, 3:05 PMEugen Mayer
06/01/2022, 3:06 PMSteve Ebersole
06/01/2022, 3:06 PMSteve Ebersole
06/01/2022, 3:07 PMEugen Mayer
06/01/2022, 3:07 PMChris Lee
06/01/2022, 3:07 PMSteve Ebersole
06/01/2022, 3:07 PMSteve Ebersole
06/01/2022, 3:08 PMSteve Ebersole
06/01/2022, 3:08 PMSteve Ebersole
06/01/2022, 3:08 PMChris Lee
06/01/2022, 3:08 PMSteve Ebersole
06/01/2022, 3:09 PMSteve Ebersole
06/01/2022, 3:09 PMSteve Ebersole
06/01/2022, 3:09 PM