gradle - 如何在Gradle中确定Multi build project的根文件夹?

标签 gradle

在构建项目之前,将创建包含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/

相关文章:

interface-builder - 如何在Gradle当前项目中添加其他项目?

android - 如何在 Gradle 中查找依赖冲突

gradle - 从 1.6 到 1.8 的 Java 升级异常

github - Gradle依赖项可从github存储库下载单个文件

Android Gradle 几个模块 :transformDexArchiveWithDexMergerForDebug task fail

logging - 如何为自定义 Gradle 插件设置不同的日志级别

google-chrome - Selenium : pc account lockout while running Test Automation in Selenium Webdriver

Android依赖配置

java - 如何从 intellij idea 项目生成可执行文件?

dependencies - Gradle,如何禁用所有传递依赖项