使用 gradle 上传公共包作品: https://github.com/ttiganik/hrd-java-test-registry/packages/61312
但是我无法下载它。我尝试了不同的 URL-s 和包名称,但它们都不起作用。
根据文档,正确的 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'
}
凭据与上传凭据相同。 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:
但它没有安装它。
如果我注释掉 maven 存储库中的凭据,它会显示 401 未经授权。所以位置似乎是正确的。
我的GPR配置有什么问题?
问题是我没有包含正确的包名称。您需要包含包名称 2x。
- implementation 'com.ttiganik:test:1.0.0'
+ implementation 'com.ttiganik.test:test:1.0.0'
直接从 Github 复制依赖项更容易。它们包括正确的名称
遇到了同样的问题,并发现如果您是 Github 上组织的一部分,您可能需要授予/授权您的令牌才能访问您的组织才能工作。在"帐户 ->设置"->"开发人员设置"-">个人访问令牌 ->令牌(经典("中转到个人访问令牌。
然后点击Configure SSO
(如果适用(,然后找到您的组织并单击授权。