On 21.01.2012, at 23:46, Luke Daley wrote: > > On 21/01/2012, at 1:37 PM, Joern Huxhorn <[email protected]> wrote: > >> I don't use separate build files for multi-module builds at all. >> Instead, I put the definitions for all modules into the same build file. Is >> this really uncommon? >> >> I always considered this a major improvement over Maven. > > For Java type projects, the most common pattern is to have the majority of > the configuration injected into the subprojects via the root and then have > project specific configuration (e.g. dependencies). > > There is of course no functional difference between this and all in one file.
I split that single Gradle file up into several logically separated files that are then applied in the build.gradle: dependencyDefinitions.gradle is only defining a map containing all external dependencies (including the version) so if I want to update such a dependency I only need to touch this file. The rest of the build script refers to those dependencies using the short placeholders. projectDependencies.gradle defines all dependencies of every sub-project. So if one of the modules/sub-projects needs an additional dependency I know immediately that I have to edit this file. config.gradle contains all the configuration of the build itself, i.e. the configuration of the tasks. (Granted, this could simply be put into build.gradle, alternatively) build.gradle is simply applying the three files above. Additionally, I choose to define the wrapper task in that file. My idea was that the gradle-version is a "build setting", i.e. it defines the build environment, so I put it in the that file. See https://github.com/huxi/sulky for an example of this structure. I'm not sure if I'm 100% happy with the above structure. On one hand, the additional config.gradle file serves the purpose of having a very small build.gradle and hiding away the complex build logic in a separate file. On the other hand it means one additional file. But anyway: The beauty of Gradle is that this isn't that important. I can always change all that structure if I'm fed up with it. It is a question of personal taste and I'm not forced to have one file for every sub-project. <3 Joern. --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email
