How to include projects in multiproject build from master directory in Gradle?

本小妞迷上赌 提交于 2019-12-10 22:18:09

问题


Lets have this structure

I am in subproject1 how to write my settings.gradle file to include subproject1 and subproject2 as subprojects of the root Project. My settings.gradle file is in master directory?

I tried:

include 'root:subproject1', 'root:subproject2'

but nothing happened.

From Gradle doc:

If you execute Gradle from within a project that has no settings.gradle file, Gradle does the following:

  • It searches for a settings.gradle in a directory called master which has the same nesting level as the current dir.
  • If no settings.gradle is found, it searches the parent directories for the existence of a settings.gradle file.
  • If no settings.gradle file is found, the build is executed as a single project build.
  • If a settings.gradle file is found, Gradle checks if the current project is part of the multiproject hierarchy defined in the found settings.gradle file. If not, the build is executed as a single project build. Otherwise a multiproject build is executed.

回答1:


includeFlat 'subproject1', 'subproject2'

includeFlat is a short form for include-ing the projects and then setting their projectDirs as appropriate for a flat directory layout.

For more information, see the "Multi-project builds" chapter in the Gradle User Guide, and the sample builds in the full Gradle distribution.



来源:https://stackoverflow.com/questions/24827146/how-to-include-projects-in-multiproject-build-from-master-directory-in-gradle

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!