Uploaded image for project: 'Maven'
  1. Maven
  2. MNG-6503

parent pom relative path regression after 3.3.9

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Duplicate
    • 3.5.4, 3.6.0
    • None
    • None
    • None
    • Windows 10, Java 8, fails with maven 3.5.4 and 3.6.0, works with 3.3.9

    Description

      Used to work in 3.3.9.  Failure to resolve parent-pom via relative-path in some cases.
       
      A trivial example, with the folder structure and the poms. You
      can see the failure by typing mvn help:effective-pom after cd'ing to the top
      project's folder.

      Here's the folder structure:

       mvntst <- top folder
          parent  <- subfolder having parent pom
          subproj <- subfolder having a sub project
      
      

      The 3 folders have a pom.xml:

      in mvntst folder (the top level folder)

      <?xml version="1.0" encoding="UTF-8"?>
       <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>mvntst</groupId>
           <artifactId>top</artifactId>
           <packaging>pom</packaging>
           <parent>
               <groupId>mvntst</groupId>
               <artifactId>parent</artifactId>
               <version>1.0.0</version>
               <relativePath>parent/pom.xml</relativePath>   <!-- works, finds the
       parent -->
           </parent>
           <modules>
             <module>subproj</module>
           </modules>
       </project>
      

      in parent subfolder:

      <?xml version="1.0" encoding="UTF-8"?>
       <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>mvntst</groupId>
           <artifactId>parent</artifactId>
           <version>1.0.0</version>
           <packaging>pom</packaging>
       </project>
      

      in subproj subfolder:

      <?xml version="1.0" encoding="UTF-8"?>
       <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>mvntst</groupId>
           <artifactId>subproj</artifactId>
           <parent>
               <groupId>mvntst</groupId>
               <artifactId>parent</artifactId>
               <version>1.0.0</version>
               <relativePath>../parent/pom.xml</relativePath>  <!-- fails -->  
           </parent>
       </project>
      

      In doing various tests: if the top pom is missing its relative-path, you get an
      expected

      Non-resolvable parent POM for mvntst:top:[unknown-version]: Failure to find
       mvntst:parent:pom:1.0.0 ...

      putting in the relative-path into the top fixes this, and results in finding the
      parent for the top level.
      If you don't have a <modules> section in the top level, the mvn
      help:effective-pom works OK.

      Putting in the <modules> section gives the error:

      Non-resolvable parent POM for mvntst:subproj:[unknown-version]: Failure to find
       mvntst:parent:pom:1.0.0

      Adding the <version> to the artifact IDs for the top and subproj doesn't help,
      except to change the error message to include the version instead of
      [unknown-version]

      Attachments

        1. mvntst.zip
          1 kB
          Marshall Schor

        Issue Links

          Activity

            People

              rfscholte Robert Scholte
              schor Marshall Schor
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: