我在gradle中有一个多项目依赖项的项目,它看起来像这样
Project Big
|--> Project A
|--> Project B
|--> Project C
|--> settings.gradle
// Dynamically include anything with a build.gradle file in the Gradle mutli-project build configuration
fileTree(dir: rootDir, include: '*/**/build.gradle')
.matching {
// Eclipse files
exclude '**/bin/'
// Gradle files
exclude '**/build/'
}
.each {
def path = it.parentFile.absolutePath - rootDir.absolutePath
include(path.replaceAll('[\\\\/]', ':')) }
我还有一个项目
Project Small
|--> settings.gradle
我想建立一个对大项目的依赖。我在这里看到了解决方案
Gradle sync issue : None of the consumable configurations have attributes
将共享库项目/模块与其源同步
但一直保持这种配置
Project Small
|--> Project Big
|--> settings.gradle
include ":big"
project(":big").projectDir = file("../project-big/")
No matching configuration of project :big was found. The consumer was configured to find an API of a library compatible with Java 11, preferably not packaged as a jar, preferably optimized for standard JVMs, and its dependencies declared externally but:
- None of the consumable configurations have attributes.
是因为我引用了多项目模块而不是单个项目吗?
1条答案
按热度按时间mwecs4sa1#
你可以试试composite builds。
假设有一个子项目
project_small/app
想要使用project_big/proj_b
:然后使用依赖项替换:
下面是一个最小的示例项目:https://github.com/chehsunliu/stackoverflow/tree/main/a.2021-08-03.gradle.68628691。