gpt4 book ai didi

java - 将 Gradle 验证为 Azure Artifacts Maven

转载 作者:行者123 更新时间:2023-12-02 08:21:23 28 4
gpt4 key购买 nike

我想要对 Azure DevOps Artifacts 的 Azure 管道进行身份验证,为此我有 vstsFeedId。该项目基于 Gradle

在本地,它的工作原理是创建个人访问 token 并使用~/.m2/settings.xml

<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
https://maven.apache.org/xsd/settings-1.0.0.xsd">
<servers>
<server>
<id><id>
<username><username>
<password><password>
</server>
</servers>
</settings>

Gradle

repositories {
mavenCentral()
maven {
url ''
name ''
authentication {
basic(BasicAuthentication)
}
}
}

但是,当我上线管道时,Gradle 无法获取依赖项,因为未设置身份验证

失败:构建因异常而失败。

* What went wrong:
Execution failed for task ':compileJava'.
> Failed to notify dependency resolution listener.
> Could not resolve all dependencies for configuration ':detachedConfiguration1'.
> You cannot configure authentication schemes for this repository type if no credentials are provided.
> Could not resolve all dependencies for configuration ':detachedConfiguration2'.
> You cannot configure authentication schemes for this repository type if no credentials are provided.

我发现Maven task有一个属性 mavenAuthenticateFeed 可能会有所帮助,而 Gradle task还没有

如何向我自己的 Azure DevOps Artifacts 存储库验证 Gradle 的身份?

最佳答案

看起来就这么简单。

使用MavenAuthenticate任务

      - task: MavenAuthenticate@0
inputs:
artifactsFeeds: ''

关于java - 将 Gradle 验证为 Azure Artifacts Maven,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68132533/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com