Azure DevOps 手动将外部库发布到 Azure Artifacts?

问题描述 投票:0回答:3

当我运行构建管道时,所有库都将发布到 Azure DevOps Artifacts(因为它们将在 Maven Central 中下载)。

但是我有一个在本地计算机上手动创建的外部库,它是一个像这张图片一样的罐子。external libraries jar

我想将此 jar 添加到 Azure DevOps Artifacts,以便下次运行管道时,它可以访问我的外部库 jar。

我该怎么做?我已经尝试过这个解决方案。但它无法工作。

az artifacts universal publish --organization https://dev.azure.com/example/ --feed my_feed --name my-artifact-name --version 0.0.1 --description "Test Description" --path
这个解决方案

maven azure-devops artifacts azure-artifacts azure-devops-pipelines
3个回答
3
投票

使用通用发布部署的工件无法被 Maven 项目读取,这使得它们在 Azure Pipelines 之外毫无用处。

要将库或外部 jar 部署到 azure,您应该按照 feed 说明配置 settings.xml,例如,

  <servers>
    <server>
      <id>FeedId</id>
      <username>user</username>
      <password>token</password>
    </server>
  </servers>

然后使用部署文件目标

mvn org.apache.maven.plugins:maven-deploy-plugin:2.4:deploy-file -Dpackaging=jar -DrepositoryId=FeedId -Durl=https://pkgs.dev.azure.com/<org>/_packaging/FeedId/maven/v1 -DgroupId=my.group.id -DartifactId=artifactId -Dversion=1.0 -Dfile=<path_to_local.jar> -DpomFile=<path_to_local.pom>

如果文件已驻留在本地存储库 (~/.m2/repository/my/group/id/artifactId) 中,请确保使用 2.4 版本。从 2.5+ 版本开始,部署插件将无法部署本地存储库中已存在的 jar。


0
投票

您可以参考az工件通用发布的文档。这是我的样本:

1.登录Azure DevOps:

az login

az devops login --organization https://dev.azure.com/{Organization}/

2.发布包:

我的文件位于

C:\sample
文件夹中:

这是我的命令:

az artifacts universal publish --organization https://dev.azure.com/{Organization}/ --feed {Feed name} --name sample.jar --version 0.0.1 --description "Welcome to Universal Packages" --path C:\sample\sample.jar.

此外,它是组织范围的提要。

如果您要将包发布到项目范围的提要,还请在命令中添加项目名称:

az artifacts universal publish --organization https://dev.azure.com/{Organization}/ --project="{Project}" --scope project --feed {Feed name} --name my-first-package --version 0.0.1 --description "Welcome to Universal Packages" --path .

0
投票

对于看到此“包名称必须是一个或多个小写字母数字段”的其他人来说,意味着没有大写字母

© www.soinside.com 2019 - 2024. All rights reserved.