项目树如下:
- APPLICATION
--- CORE_LIBRARY
----- SUBLIBRARY1
----- SUBLIBRARY2
----- SUBLIBRARY3
我希望CORE_LIBRARY
声明自己的依赖项,而APPLICATION
只包含CORE_LIBRARY及其所有依赖项。
应用/ CORE_LIBRARY /的build.gradle
dependencies {
compile project('SUBLIBRARY1')
compile project('SUBLIBRARY2')
compile project('SUBLIBRARY3')
}
应用/ CORE_LIBRARY / settings.gradle
include 'SUBLIBRARY1', 'SUBLIBRARY2', 'SUBLIBRARY3'
到目前为止一切顺利。现在我可以从 APPLICATION / CORE_LIBRARY 目录运行'gradle assemble'。
但接下来是问题,只是包括CORE_LIBRARY到APPLICATION
APPLICATION / build.gradle
dependencies {
compile project('CORE_LIBRARY')
}
APPLICATION / settings.gradle
include ':CORE_LIBRARY'
这不起作用,我们需要从 APPLICATION / settings.gradle 中引用':CORE_LIBRARY:SUBPROJECT1', ... etc
。
我们不能只包含所有子项目依赖项吗?