使用 Gradle 导入源依赖项 (Kotlin DSL)

Importing a source dependency with Gradle (Kotlin DSL)

我想导入这个项目的1.0.0版本https://github.com/whichdigital/ksv 作为 Kotlin 项目中的 source dependency 使用 Gradle 6.3 和 Kotlin DSL。

正如页面告诉我的那样,我将其添加到我的项目settings.gradle.kts

sourceControl {
    gitRepository(java.net.URI.create("https://github.com/whichdigital/ksv.git")) {
        producesModule("uk.co.whichdigital:ksv")
    }
}

并在我的 build.gradle.kts 文件中使用此依赖项:

implementation("uk.co.whichdigital:ksv:1.0.0")

正在尝试导入标记为 version/release KSV 存储库的 1.0.0。但是构建我的项目(导入 KSV 存储库)失败并出现以下预期:

TaskDependencyResolveException: Could not determine the dependencies of task ':bootJar'.
...
Caused by: DefaultLenientConfiguration$ArtifactResolveException: Could not resolve all task dependencies for configuration ':runtimeClasspath'.
....
Caused by: ModuleVersionResolveException: Git repository at https://github.com/whichdigital/ksv.git did not contain a project publishing the specified dependency.
Required by:
    project :

其实我也是 wrote/published KSV-repository 的人,所以如果我遗漏了一些配置,我可以在导入或导入的项目中添加它。

"uk.co.whichdigital:ksv:1.0.0" group id is wrong.

你能试试吗

sourceControl {
   gitRepository(java.net.URI.create("https://github.com/whichdigital/ksv.git")) {
     producesModule("uk.co.whichdigital.ksv:ksv")
   }
}

implementation("uk.co.whichdigital.ksv:ksv:1.0.0")