无法使用Maven部署工件,错误代码409 [英] Failed to deploy artifacts using maven, error code 409

查看:2163
本文介绍了无法使用Maven部署工件,错误代码409的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用azure devops,并尝试使用maven构建代码并上传,但是我收到以下错误消息.

I am using azure devops, and trying to building code and upload using maven, but i am getting following error message.

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy-file 
(default-cli) on project ojdbc7: 

com.huber.abc:ojdbc7:jar:2.0 from
to dev-azure-com-abc-devops-abc-artifacts (https://pkgs.dev.azure.com/ABC-DevOps/_packaging/abc- 
Artifacts/maven/v1):

Failed to transfer file 

https://pkgs.dev.azure.com/abc-DevOps/_packaging/abc- 
Artifacts/maven/v1/com/huber/abc/ojdbc7/2.0/ojdbc7-2.0.jar with status code 409 -> [Help 1]Failed to 
deploy artifacts: 

Could not transfer artifact

我发现了一个问题线程之类的问题.根据该链接,不使用快照,而使用发布.所以我在这里添加我的pom.xml文件作为参考.

I had found one question thread like similar issue. As per that link don't use snapshot but use release. So I am adding my pom.xml file here for the reference.

<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.myorg.abc</groupId>
  <artifactId>ojdbc7</artifactId>
  <version>2.0</version>
</project>

我不知道如何解决此问题.我已经看到许多版本的错误409.但是看来我的问题有所不同,请指导我.

I don't know how to resolve this issue. I have seen many versions of error 409. But it seems my issue is different, please guide me.

推荐答案

这不是一个完整的答案,但可能会有所帮助. 我是Azure Dev Ops和Maven的新手,因此请原谅并更正注释中的任何错误. 我已经重复了一些事情,OP知道这些事情可以使其他人更加清楚答案.

This is not a complete answer but it may help a little. I am new to both Azure Dev Ops and Maven so please forgive and correct any mistakes in the comments. I have repeated some things its clear the OP knows to make the answer clearer to others.

Maven允许您部署两种工件:

Maven allow you to deploy two kinds of artifact:

  1. 快照

  1. SNAPSHOTS

  • 快照是软件包的开发版本.
  • 快照的后缀为-SNAPSHOT.例如. 1.2.0-快照
  • 快照是可变的.部署操作可以用新版本替换SNAPSHOT (更多最新的开发版本可以替代开发版本)
  • A snapshot is a development version of a package.
  • Snapshots have the suffix -SNAPSHOT. E.g. 1.2.0-SNAPSHOT
  • SNAPSHOTS are mutable. A deploy operation can replace a SNAPSHOT with a new version (more recent development versions can replace development versions)

释放

  • 任何未以后缀-SNAPSHOT结尾的版本均视为发行版本.
  • 发布是一成不变的.如果已将发行版部署到存储库,则部署操作将失败.

409 =资源冲突

这可能意味着

  • 该工件已经发布,不能被覆盖

  • The artifact has already been published and cannot be overwritten

无法发布工件,因为它是错误的类型. 例如,将发布发布到仅接受快照的存储库 或将快照发布到仅接受发布的存储库中

The artifact could not be published because it was the wrong type. For example publishing a release to a repository that only accepts snapshots or publishing a snapshot to a repository that only accepts releases

另请参阅:

See also: How to update a maven dependency with a same version number in Azure Artifacts (you can't for a release)

我不确定如何告诉Maven如果工件已经存在,则部署失败是可以的. (在Linux中)明显和错误的黑客攻击是:

I am not sure how to tell maven that its okay for the deployment to fail if the artifact already exists. The obvious and wrong hack (in Linux) is:

mvn deploy || /bin/true

我不确定Azure中的等效项是什么,或者不确定是否有maven选项使其表现为这种方式. 这种黑客行为很糟糕,因为如果由于其他原因失败,它将报告部署步骤成功.

I'm not sure what the equivalent is in Azure or if there is an option to maven that makes it behave this way. This hack is bad because it will report the deployment step as successful if it has failed for another reason.

有一个插件 https://github.com/chonton/exists-maven-plugin ,请参见 https://stackoverflow.com/a/53623937/1569204 .同样,我不确定如何在Azure上启用它.

There is a plugin https://github.com/chonton/exists-maven-plugin that does this see https://stackoverflow.com/a/53623937/1569204. Again I am not sure how to enable this on Azure.

我以 查看全文

登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆