2

项目树如下:

- APPLICATION
--- CORE_LIBRARY
----- SUBLIBRARY1
----- SUBLIBRARY2
----- SUBLIBRARY3

我希望CORE_LIBRARY声明自己的依赖项,并且APPLICATION只包含 CORE_LIBRARY 及其所有依赖项。

APPLICATION/CORE_LIBRARY/build.gradle

dependencies {
    compile project('SUBLIBRARY1')
    compile project('SUBLIBRARY2')
    compile project('SUBLIBRARY3')
}

APPLICATION/CORE_LIBRARY/settings.gradle

include 'SUBLIBRARY1', 'SUBLIBRARY2', 'SUBLIBRARY3'

到目前为止,一切都很好。现在我可以从APPLICATION/CORE_LIBRARY目录运行“gradle assemble”了。
但是问题来了,只需将 CORE_LIBRARY 包含到 APPLICATION

应用程序/build.gradle

dependencies {
    compile project('CORE_LIBRARY')
}

应用程序/settings.gradle

include ':CORE_LIBRARY'

这不起作用,我们需要':CORE_LIBRARY:SUBPROJECT1', ... etcAPPLICATION/settings.gradle中引用。

我们不能只包含所有子项目依赖项吗?

4

0 回答 0