2

我们有一个像这样的项目结构:

root
    core
        auth
        ...

在根目录的 build.gradle 文件中:

allprojects {
    apply plugin: 'idea'
}

及其settings.gradle:

include 'core'

核心有一个 gradle.build 文件和一个 settings.gradle :

include 'auth'

因此,当我从根目录运行时:

gradle idea

它将在根目录上构建 ipr、iws 和 iml 文件,并且 core 文件夹将有一个 core.iml。但是 auth 模块没有被创建。我必须进入 intellij 并手动将模块添加到核心。有点烦人。gradle 是否支持像这样的深度嵌套项目,或者这是 IDEA 插件的限制?或者,很可能,我做错了什么:)

4

1 回答 1

5

Figured it out. I'll phrase this for best google results: A deeply nested gradle project only can have one settings.gradle file at the root, and it looks like this:

include 'core'
include 'core:auth'

Once this is done, gradle will read in all subprojects and configure IDEA accordingly.

于 2012-10-05T01:10:43.587 回答