我的项目结构包含 3 个模块:
:library
、:shared
和 :internal
。:library
--取决于--> :internal
通过实现:library
--取决于--> :shared
通过 api:internal
--取决于--> :shared
通过 实现
因此,
:library
使用:internal
、without暴露它和:shared
暴露它。
此外,:internal
也使用 :shared
。
问题: 如何使用
:library
Gradle 插件发布 maven-publish
模块并包含其他模块源?
目前,我的发布看起来像这样(:library
的
build.gradle.kts):
publishing {
publications {
register<MavenPublication>("release") {
groupId = Project.GROUP_ID
artifactId = Project.ARTIFACT_ID
version = Project.VERSION
from(components["release"])
}
}
}
但是在发布(我使用 JitPack)并将其添加为另一个项目的 build.gradle 文件中的依赖项之后,我在尝试构建它时遇到以下错误:
> Could not resolve all files for configuration ':app:debugCompileClasspath'.
> Could not find [:shared module].
Required by:
project :app > [`:library` module]
如何向已发布的模块提供我的依赖模块?
我认为这可行:
我面临同样的问题,我正在尝试不同的方法来解决它,这看起来很不错,尚未测试,但看起来非常接近可能的解决方案。