【发布时间】:2024-05-04 03:15:05
【问题描述】:
我正在尝试将 Github 包用作 maven 存储库。
当我直接指向这样的仓库时:
repositories {
maven {
url = uri("https://maven.pkg.github.com/ORG/REPO")
credentials {
username = 'some-user'
password = 'github-token-with-repo-scope'
}
}
}
然后像这样拉取依赖:
dependencies{
implementation 'groupId:artifcatId:1.0.0-snapshot'
}
有效。
但如果我不想将 maven url 限制为特定 repo ,并直接使用 ORG url
url = uri("https://maven.pkg.github.com/ORG')
它不会找到相同的神器说:
Could not find groupId:artifcatId:1.0.0-snapshot.
我已尝试将 REPO 名称添加到依赖声明中
dependencies{
implementation 'REPO:groupId:artifcatId:1.0.0-snapshot'
}
还是不行。
任何人都知道如何将 ORG url 用作 MAVEN REPOSITORY,而不是向每个 repo 添加多个 url(并乘以登录调用等...)
谢谢!
【问题讨论】:
-
IIRC,您需要传递访问令牌才能访问 GitHub 包注册表:help.github.com/en/github/…
-
@Edric 我确实通过了一个,正如您从第一块代码中看到的那样。
标签: maven gradle github github-package-registry