[HAP-1019] Pipeline script can't resolve Snapshot parent Pom from Artifactory Created: 03/Jan/18  Updated: 14/Mar/18  Resolved: 14/Mar/18

Status: Resolved
Project: Jenkins Artifactory Plug-in
Component/s: None
Affects Version/s: 2.14.0
Fix Version/s: 2.15.0

Type: Bug Priority: Normal
Reporter: Matthew Wang Assignee: Dima Nevelev (Inactive)
Resolution: Fixed Votes: 1
Labels: None

Attachments: HTML File pipelinescript     PNG File screenshot-1.png    
Issue Links:
Relationship
relates to BI-443 Maven fails to resolve snapshot paren... Resolved

 Description   

If you have a project that pulls a parent pom from Artifactory, the parent pom can't be pulled if the version is a snapshot. The same build works fine if it is a release version. Steps to reproduce:

-create local maven repo (we'll call it pom-local). Upload following pom.xml to the repo as a Maven artifact:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.example</groupId>
    <artifactId>ParentExample</artifactId>
    <version>1.0.0-SNAPSHOT</version>
    <name>ParentExample</name>
    <packaging>pom</packaging>
</project>

-Upload same pom file to the same repo except with version 1.0.0 as a maven artifact:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.example</groupId>
    <artifactId>ParentExample</artifactId>
    <version>1.0.0</version>
    <name>ParentExample</name>
    <packaging>pom</packaging>
</project>

-Create Pipeline job: see attached
-Use attached project in the jenkins workspace.

-Run build and see that it fails to resolve the parent pom:

[main] ERROR org.apache.maven.cli.MavenCli -     Non-resolvable parent POM for com.example:HelloWorld:0.0.1-SNAPSHOT: Could not find artifact com.example:ParentExample:pom:1.0.0-SNAPSHOT and 'parent.relativePath' points at wrong local POM @ line 7, column 9 -> [Help 2]

-Run build with the release version 1.0.0 this time in the child pom in the jenkins workspace, and see the build succeeds:

<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

<!--The identifier of the parent POM-->

<parent>
    <groupId>com.example</groupId>
    <version>1.0.0</version>
    <artifactId>ParentExample</artifactId>
</parent>

<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>HelloWorld</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>MavenExamples Child POM</name>
<packaging>jar</packaging>

</project>


 Comments   
Comment by Dima Nevelev (Inactive) [ 17/Jan/18 ]

In the provided pipeline script, both releaseRepo and snapshotRepo resolver repositories configured to be "pom-local".
Are you sure that the SNAPSHOT pom version exists in this repository?

Comment by Dima Nevelev (Inactive) [ 30/Jan/18 ]

A snapshot version which includes the fix for this issue can be downloaded from here

Generated at Thu Nov 14 01:44:04 UTC 2019 using JIRA 7.6.16#76018-sha1:9ed376192612a49536ac834c64177a0fed6290f5.