且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Gradle将多模块项目中的嵌套子项目添加为另一个子项目的依赖项

更新时间:2021-11-04 06:34:47

假定项目 sp1 sp2 是项目 p3 个子项目,如果您想这样做:

Assuming project sp1 and sp2 are subprojects of project p3, if you want to do:

dependencies {
    compile project(':p3:sp1')
}

然后,您需要将 settings.gradle 更改为:

Then you need to change your settings.gradle to:

rootProject.name = root

include ':p1'
include ':p2'
include ':p3'    // Keep this if this folder contains a build.gradle
include ':p3:sp1'
include ':p3:sp2'