Gradle 无法从 Github 包注册表下载包

app*_* 27 5 gradle github-package-registry

使用 gradle 上传公共包:https : //github.com/ttiganik/hrd-java-test-registry/packages/61312

但我无法下载它。我尝试了不同的URL-s 和 package names,但它们都不起作用。

根据文档,正确的 URL-s 应该是:

repositories {
    maven {
        url "https://maven.pkg.github.com/ttiganik/hrd-java-test-registry"
        credentials {
            username = System.properties['hmGithubUser']
            password = System.properties['hmGithubToken']
        }
    }
}

dependencies {
    implementation 'com.ttiganik:test:1.0.0'
}
Run Code Online (Sandbox Code Playgroud)

凭据与上传的凭据相同。

gradle installDebug 说它从正确的位置看:

> Could not find com.ttiganik:test:1.0.0.
  Searched in the following locations:
    - https://maven.pkg.github.com/ttiganik/com/ttiganik/test/1.0.0/test-1.0.0.pom
    - https://maven.pkg.github.com/ttiganik/com/ttiganik/test/1.0.0/test-1.0.0.jar
  Required by:
Run Code Online (Sandbox Code Playgroud)

但它不会安装它。

如果我注释掉 maven 存储库中的凭据,它会显示 401 unauthorised。所以位置似乎是正确的。

我的 GPR 配置有什么问题?

app*_* 27 0

问题是我没有包含正确的包名称。您需要包含包名称 2x。

-     implementation 'com.ttiganik:test:1.0.0'
+     implementation 'com.ttiganik.test:test:1.0.0'

Run Code Online (Sandbox Code Playgroud)

直接从 Github 复制依赖项会更容易。它们包括正确的名字