簡體   English   中英

如何使用 azure 管道部署 jar 文件到 azure 工件使用 maven 任務

[英]How to use azure pipeline to deploy jar files to azure artifact using maven task

我創建了一個 azure 工件並將其添加到 pom.xml 並使用令牌在代理機器中配置 ~/.m2/settings.xml。 當我在本地部署時它可以工作但是當我在 azure 管道中使用 maven 任務時出現此錯誤。 用戶擁有所有權限

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:3.0.0:deploy (default-deploy) on project my-server: Failed to deploy artifacts: Could not transfer artifact:pom:1.0 from/to artifact authorization failed for https://pkgs.dev.azure.com/, status: 403 Forbidden - User '7ba7a839-2613-4554-84a4-4aa2d4cf4162' lacks permission to complete this action. You need to have 'AddPackage'. (DevOps Activity ID: 46D5F76C-E82C-48C8-8D63-4269F3CE4F65) -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

我嘗試使用 windows 它成功運行,但我使用 Linux centos7 作為代理來運行我的管道

可以嘗試在Maven任務前加一個MavenAuthenticate 任務

在代理上運行管道作業時, Maven 身份驗證任務將在代理機器上當前用戶的主目錄中搜索settings.xml文件。 對於 Linux 和 Mac,路徑為$HOME/.m2/settings.xml 對於 Windows,路徑為%USERPROFILE%\.m2\settings.xml 如果settings.xml文件不存在,則會在該路徑下創建一個新文件以供使用。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM