【发布时间】:2021-11-24 08:30:43
【问题描述】:
我正在尝试使用 Gradle 将 git 存储库 (https://github.com/FHNW-IP5-IP6/ComposeForms) 作为依赖项添加到我的项目中,并尝试了来自 Is it possible to declare git repository as dependency in android gradle? 的下面列出的变体 (1.-3.) 但每次我同步项目时我收到一条错误消息:“无法解析 com.github.FHNW-IP5-IP6:ComposeForms:master-SNAPSHOT”。
我尝试了以下方法:
-
Jitpack (https://jitpack.io/#FHNW-IP5-IP6/ComposeForms/master-SNAPSHOT)
allprojects { repositories { ... maven("https://jitpack.io") // also tried uri https://www.jitpack.io } }在 app build.gradle 中
kotlin { sourceSets { named("main") { dependencies { ... implementation("com.github.FHNW-IP5-IP6:ComposeForms:master-SNAPSHOT") } } } } -
Git 子模块(命名为 compose-forms)
include(":compose-forms")在 settings.gradle 中kotlin { sourceSets { named("main") { dependencies { ... implementation(project(":compose-forms")) } } } } -
gradle 中的新功能
在 settings.gradle 中
sourceControl { gitRepository(uri("https://github.com/FHNW-IP5-IP6/ComposeForms.git")) { producesModule("compose-forms") } }在 app build.gradle 中
kotlin { sourceSets { named("main") { dependencies { ... implementation("compose-forms") { version { branch = "master" } } } } } }
我的选项不多了,我真的需要 git 存储库作为依赖项。我不希望我的项目中有任何 git 子模块,所以我更喜欢数字 1 和 3 工作。提前感谢您的任何提示:)
【问题讨论】:
标签: android gradle git-submodules gradle-kotlin-dsl jitpack