在构建项目之前,将创建包含rootDir变量的Settings对象。
rootDir : The root directory of the build. The root directory is the project directory of the root project.
此外,文档指出,它永远不能为null。
File getRootDir()
Returns the root directory of the build. The root directory is the project directory of the root project.
Returns:
The root directory. Never returns null.
我想知道在多重构建项目中如何确定rootDir。它是包含build.gradle的最高目录吗?
最佳答案
详细信息可以在test specification中找到
简单版本:向上进入目录层次结构并搜索settings.gradle
文件。如果找不到它,或者当使用--no-search-upward
开头时,它可以返回当前目录。或者,您可以使用settings.gradle
传递--settings-file
的位置。
关于gradle - 如何在Gradle中确定Multi build project的根文件夹?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27171503/