目标部署路径“...”与 POM 的预期路径前缀不匹配

Mic*_*ihs 3 artifactory maven jenkins jenkins-pipeline

我正在尝试将pom.xml文件上传到 Artifactory 服务器上托管的 Maven 存储库。该<project>部分pom.xml如下所示:

<groupId>com.x.y.z</groupId>
<artifactId>common</artifactId>
<version>2.3.0-RELEASE</version>
<packaging>jar</packaging>
Run Code Online (Sandbox Code Playgroud)

我在 Pipeline 脚本中使用 Jenkins 的 Artifactory 插件,这是uploadSpec

<groupId>com.x.y.z</groupId>
<artifactId>common</artifactId>
<version>2.3.0-RELEASE</version>
<packaging>jar</packaging>
Run Code Online (Sandbox Code Playgroud)

当我现在尝试上传工件时,收到以下错误消息:

java.io.IOException: Failed to deploy file. 
  Status code: 409 
  Response message: Artifactory returned the following errors: 
    The target deployment path 'com/x/y/z/common/2.3.0-RELEASE/common-2.3.0-RELEASE.pom' 
    does not match the POM's expected path prefix 'com/x/y/z/common/2.2.7'. 
    Please verify your POM content for correctness and make sure the source path is a valid Maven repository root path. Status code: 409
Run Code Online (Sandbox Code Playgroud)

在上传 之前RELEASE,我上传了一个SNAPSHOT(在本例中)版本为 2.2.7-SNAPSHOT 的文件。之后,我将版本升级为2.3.0,使用 重新构建项目mvn clean install,然后开始另一次上传到 Artifactory。不知何故,当我尝试上传新版本时,Artifactory 似乎仍然期待“旧”版本。

编辑

当我使用 上传文件时curl,一切都按预期进行:

curl -user:password-T pom.xml \
"http://DOMAIN/artifactory/REPOSITORY/com/x/y/z/common/2.3.0-RELEASE/common-2.3.0-RELEASE.pom"
Run Code Online (Sandbox Code Playgroud)

所以这似乎与 Jenkins Artifactory 插件有关。

JBa*_*uch 5

您将 pom 文件上传到了错误的位置。你用

REPOSITORY/com/x/y/z/common-2.3.0-RELEASE.pom
Run Code Online (Sandbox Code Playgroud)

作为一条路径,当路径应该是

REPOSITORY/com/x/y/z/common/2.3.0-RELEASE/common-2.3.0-RELEASE.pom
Run Code Online (Sandbox Code Playgroud)

请注意缺少的以版本命名的目录。

好消息是您甚至不需要为此操心。当您使用我们的Artifactory.newMavenBuildMaven 构建时,我们将负责正确的部署。请参阅示例