M-K*_*M-K 6 scala azure sbt azure-devops
我想在我的 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")
Run Code Online (Sandbox Code Playgroud)
但我总是收到消息
无法找到 [ https://pkgsprodsu3weu.app.pkgs.visualstudio.com/ @ pkgs.dev.azure.com ]的凭据
从逻辑上讲,身份验证失败
401 未经授权
我已经尝试遵循问题https://github.com/sbt/sbt/issues/5492和https://github.com/sbt/ivy/pull/36中的建议,但没有结果
小智 6
我测试了使用 sbt 连接到 Azure Artifacts feed 的不同方法。从所有测试的组合中,我找到了一种似乎有效的组合。我使用sbt v1.3.10进行测试,这是撰写本文时最新的官方发布版本。
定义 sbt 版本build.properties:
sbt.version = 1.3.10
Run Code Online (Sandbox Code Playgroud)
实际上使用 Azure Artifacts feed build.sbt:
// 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")
Run Code Online (Sandbox Code Playgroud)
最后但并非最不重要的一点是,将凭证的属性文件中的领域保持为空非常重要。
所以在~/.sbt/azureArtifactsFeed.credentials:
realm=
host=pkgs.dev.azure.com
user=ORGANIZATION
password=USER_TOKEN_WITH_PACKAGING_READ_AND_WRITE_SCOPE
Run Code Online (Sandbox Code Playgroud)
如果(也许)您正在使用交叉编译的项目(使用sbt-crossproject),您必须将凭据添加到要发布的项目的设置中,如下所示:
lazy val myProject = crossProject(JSPlatform, JVMPlatform).in(file("."))
.settings(
organization := "com.example",
name := "my project name",
credentials += Credentials("", "pkgs.dev.azure.com", "Username", "5mctdrtasdasdLongAccesstokenwithManyCharacterscytgcg2hlura")
// ...
)
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2581 次 |
| 最近记录: |