Uploaded image for project: 'Maven Archetype'
  1. Maven Archetype
  2. ARCHETYPE-368

Enforced parent of modules gets replaced by project parent

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Won't Fix
    • 2.0
    • None
    • Creator
    • None
    • Maven 3.0.2

    Description

      We want to have archetype that creates a project with modules. Child modules should not inherit from the project POM. This is the model presented in the Maven Guide: section 3.6.2.2 http://sonatype.com/books/mvnref-book/reference/pom-relationships-sect-multi-vs-inherit.html

      Example:

      test-project/
        pom.xml: parent is com.test.pom:my-meta-parent
      
        test-module1/
          pom.xml: parent should be com.test.pom:my-parent-1
        test-module2/
          pom.xml: parent should be com.test.pom:my-parent-2
        test-module3/
          pom.xml: parent should be test-project
      

      In the archetype, I have:

      project-archetype/
        src/main/resources/
          __rootArtifactId__-module1/
            pom.xml:
              <project>
                <modelVersion>4.0.0</modelVersion>
                <parent>
                  <groupId>com.test.pom</groupId>
                  <artifactId>my-parent-1</artifactId>
                  <version>RELEASE</version>
                </parent>
                ...
          __rootArtifactId__-module2/
            pom.xml:
              <project>
                <modelVersion>4.0.0</modelVersion>
                <parent>
                  <groupId>com.test.pom</groupId>
                  <artifactId>my-parent-2</artifactId>
                  <version>RELEASE</version>
                </parent>
                ...
          __rootArtifactId__-module3/
            pom.xml:
              <project>
                <modelVersion>4.0.0</modelVersion>
                <parent>
                  <groupId>${groupId}</groupId>
                  <artifactId>${rootArtifactId}</artifactId>
                  <version>${version}</version>
                </parent>
                ...
      

      When the archetype is used to create a project, all <parent> of module get replaced by the new project Pom.xml... They all end up with:

                <parent>
                  <groupId>com.test.project</groupId>
                  <artifactId>test-project</artifactId>
                  <version>0.0.1-SNAPSHOT</version>
                </parent>
      

      Is there a way to fix this? Thanks!

      Attachments

        Activity

          People

            Unassigned Unassigned
            legege Georges-Etienne Legendre
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: