gradle - azure devops - gradle 身份验证

标签 gradle azure-devops build.gradle azure-artifacts

我正在尝试使用 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 文件中使用它进行检查。

enter image description here

并且请确保您使用最新的设置方式来配置身份验证:

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/

相关文章:

android - Android 4.4上的OneSignal崩溃

Azure 在 VSTS 中找不到任何存储库

.net - .NET Framework 是否有发布任务? (不是 .NET Core)

azure - 创建新分支时如何触发管道

android - 编译时 build.gradle 错误 'com.firebase:firebase-client-android:2.5.0'

android - Gradle 同步 : Failed to resolve (library name)

gradle - Gitlab:构建后apk的位置

java.util.zip.ZipException : duplicate entry with firebase

configuration - Ivy 和 Gradle 配置是否相同?

java - 无法在 Android Studio 中生成签名的 apk,出现错误