gpt4 book ai didi

azure - 使用 sbt : Unable to find credentials for 将 scala 项目发布到 azure feed

转载 作者:行者123 更新时间:2023-12-04 01:29:48 24 4
gpt4 key购买 nike

我想在我的 azure devOps Feed 测试中使用“stbpublish”来发布我的 scala 项目(=多项目)。为此,我根据要求进行了以下设置。

publishTo := {Some("azure" at "https://pkgs.dev.azure.com/anyTeam/blub12351234154124/_packaging/Test/maven/v1")}

credentials += Credentials("", "pkgs.dev.azure.com", "Username", "5mctdrtasdasdLongAccesstokenwithManyCharacterscytgcg2hlura")

但我总是收到消息

Unable to find credentials for [https://pkgsprodsu3weu.app.pkgs.visualstudio.com/ @ pkgs.dev.azure.com]

逻辑上身份验证失败

401 Unauthorized

我已经尝试遵循问题 https://github.com/sbt/sbt/issues/5492 中的建议和 https://github.com/sbt/ivy/pull/36但没有结果

我还测试了插件https://github.com/arktekk/sbt-aether-deploy

最佳答案

我测试了使用 sbt 连接到 Azure Artifacts 源的不同方法。从所有测试的组合中,我找到了一种似乎有效的组合。我使用 sbt v1.3.10 进行测试,这是撰写本文时最新的官方发布版本。

build.properties中定义sbt版本:

sbt.version = 1.3.10

实际上在 build.sbt 中使用 Azure Artifacts feed:

// Go back to Apache Ivy for library management.
// Coursier is currently not able to work with Azure Artifacts feeds.
ThisBuild / useCoursier := false

// Specify credentials in a properties file.
// Not 100% sure if I tested hard coded credentials.
// I did test specifying credentials in ~/.m2/settings.xml which did not work
// (but I'm not sure if either Ivy or Coursier are meant to pick them up).
credentials += Credentials(Path.userHome / ".sbt" / "azureArtifactsFeed.credentials")

// Specify the resolver using the following syntax.
// I tested creating an Ivy resolver using Resolver.url() with Resolver.mavenStylePatterns
// (thinking we're using Ivy anyways and it seems to support maven repos), but that failed
// as well (again, I'm not 100% sure if that's supposed to work in the first place).
resolvers += "SOME_NAME" at
"https://pkgs.dev.azure.com/ORGANIZATION/FEED_UUID/_packaging/FEED_NAME/maven/v1"

// With the setup so far, we should already be able to consume artifacts.
// Now for the publishing part:
publishTo := Some("SOME_NAME" at
"https://pkgs.dev.azure.com/ORGANIZATION/FEED_UUID/_packaging/FEED_NAME/maven/v1")

最后但并非最不重要的一点是,将凭据的属性文件中的领域保持为空非常重要。

所以在~/.sbt/azureArtifactsFeed.credentials中:

realm=
host=pkgs.dev.azure.com
user=ORGANIZATION
password=USER_TOKEN_WITH_PACKAGING_READ_AND_WRITE_SCOPE

关于azure - 使用 sbt : Unable to find credentials for 将 scala 项目发布到 azure feed,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61274850/

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