Gradle - 如何一起构建 2 个多模块项目? (或其他项目的模块)

问题描述 投票:0回答:2

如何一起构建2个多模块项目? (或其他项目的模块)

我在几年没有使用 gradle 后又回到了 gradle 并想一起编译更多模块 但这些模块有自己的

settings.gradle
,所以看起来gradle认为它们是完全独立的项目,不能混合。至少当我尝试时会出错。

示例项目https://github.com/emeraldpay/polkaj

我添加示例一起编译

// compiling 6 examples together with the polkaj library
include(':balance')
project(':balance').projectDir = file('./examples/balance')
include(':encoding')
project(':encoding').projectDir = file('./examples/encoding')
include(':keys')
project(':keys').projectDir = file('./examples/keys')
include(':rpc')
project(':rpc').projectDir = file('./examples/rpc')
include(':runtime-explorer')
project(':runtime-explorer').projectDir = file('./examples/runtime-explorer')
include(':types')
project(':types').projectDir = file('./examples/types')

但是随后会出现如下错误

在根项目“MyProject”中找不到项目“MyProject”。

Android:在根项目“MyProject”中找不到项目“MyProject”

如何一起构建 2 个多模块项目?(或其他项目的模块)

java gradle composition multi-module
2个回答

0
投票

尝试在项目根目录的

includeBuild("my-utils")
上使用
settings.gradle
添加模块。

请参阅 https://github.com/android/nowinandroid/ 获取类似示例。

© www.soinside.com 2019 - 2024. All rights reserved.