我正在尝试使用 azure devops artifacts repo 配置 build.gradle。它早些时候使用 AZURE_ARTIFACTS 凭据工作,但 azure 最近改变了 build.gradle 连接到工件存储库的方式
url 'https://pkgs.dev.azure.com/dp-name/_packaging/dp-name/maven/v1'
name 'dp-name'
authentication {
basic(BasicAuthentication)
}
}
gradle 构建失败并出现以下错误
> Could not resolve all dependencies for configuration ':compileClasspath'.
> You cannot configure authentication schemes for this repository type if no credentials are provided.
* Try:
最佳答案
如果它曾经有效但最近失败了,您可能需要检查 PAT 是否仍然有效。尝试创建一个新的 PAT 并在 settings.xml
文件中使用它进行检查。
并且请确保您使用最新的设置方式来配置身份验证:
1. 将此部分添加到 repositories 和 publishing.repositories 容器中的 build.gradle 文件中:
maven {
url 'https://pkgs.dev.azure.com/xxx/xxx/_packaging/xxx/maven/v1'
name 'xxx'
authentication {
basic(BasicAuthentication)
}
}
2.在${user.home}/.m2中添加或编辑settings.xml文件:
<server>
<id>looi</id>
<username>xxx</username>
<password>[PERSONAL_ACCESS_TOKEN]</password>
</server>
关于gradle - azure devops - gradle 身份验证,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60190431/