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

submodule with $revision version can't be referenced by a normal version number

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 3.6.1
    • None
    • Dependencies
    • None

    Description

      In the following example, pp/pom.xml can't reference its parent with a specific version number ("<version>1-SNAPSHOT</version>") - Unless pp1:pp-pom:pom:1-SNAPSHOT is already present in a maven repository, the build will fail.

      Maven reads the parent poms and caches them, before resolving $revision. Therefore it just caches the artifact version "${revsion}" and fails to load the local parent pom, if the parent reference does not also use the version "${revision}"

      Precondition: Non of these artificats is already present in a local or remote maven repository.

      File pom.xml:

      <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>pp</groupId>
       <artifactId>y-pom</artifactId>
       <name>yy</name>
       <packaging>pom</packaging>
       <version>1-SNAPSHOT</version>
      
      <modules>
       <module>pp1</module>
       <module>pp</module>
       </modules>
      <properties>
       <revision>1-SNAPSHOT</revision>
       </properties>
      </project>
      

      File ./pp/pom.xml:

      <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>pp</groupId>
       <artifactId>pp-pom</artifactId>
       <name>PP</name>
       <packaging>pom</packaging>
       <version>${revision}</version>
       <parent>
       <groupId>pp1</groupId>
       <artifactId>pp-pom</artifactId>
       <version>1-SNAPSHOT</version>
       <!--<version>${revision}</version>-->
       <relativePath>../pp1/pom.xml</relativePath>
       </parent>
       <properties>
       <revision>1-SNAPSHOT</revision>
       </properties>
      
      </project>
      

      File ./pp1/pom.xml:

      <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>pp1</groupId>
       <artifactId>pp-pom</artifactId>
       <name>PP</name>
       <packaging>pom</packaging>
       <version>${revision}</version>
      
      <properties>
       <revision>1-SNAPSHOT</revision>
       </properties>
      </project>
      

       

      Attachments

        Activity

          People

            Unassigned Unassigned
            martin.koegler@brz.gv.at Martin K
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: