Uploaded image for project: 'Jenkins Artifactory Plug-in'
  1. Jenkins Artifactory Plug-in
  2. HAP-1019

Pipeline script can't resolve Snapshot parent Pom from Artifactory

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: 2.14.0
    • Fix Version/s: 2.15.0
    • Component/s: None
    • Labels:
      None

      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>
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                diman Dima Nevelev (Inactive)
                Reporter:
                mattheww Matthew Wang
              • Votes:
                1 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: