I've seen different layouts for a multi-module project where some will have a single build.gradle
while others projects will have a build.gradle
at the root and a build.gradle
in each subproject. I was wondering what is the difference and which layout is preferred?
You can use a single build.grade
in the root project to inject configuration to all sub-projects using the allprojects
or subprojects
script blocks. This will work well for defining a common configuration for all projects/sub-projects and is mostly suitable where all projects are of the same type.
However, if some of the sub-projects needs to be further customized then the right place for these customization would be in the build.gradle
file located in the sub-project folder.
You can read more about your options for configuring multi-project builds in gradle documentation here , and some more information about your options in organizing your build logic in gradle user guild here .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.