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

rootArtifactId is interpreted incorrectly in maven-archetype-plugin:2.0-alpha-5 (was okay in 2.0-alpha-4)

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Won't Fix
    • 2.0-alpha-5
    • None
    • Generator
    • None
    • Mac OS X 10.6.3, Java 1.6.0_17, Maven 3.0-beta-1

    Description

      Apparently a modification was made to the maven-archetype-plugin in 2.0-alpha-5 that has changed the way that rootArtifactId is interpreted. A similar issue has been reported, but with somewhat different symptoms (ARCHETYPE-298).

      If you install the attached demo-archetype (multimodule) and then create a project from it, rootArtifactId will be interpreted differently between 2.0-alpha-4 and 2.0-alpha-5. This demo-archetype uses the supplied artifactId (when creating a project) to 'derive' the desired parent and sub-module artifactIds with the following expressions in the respective archetype poms:

      parent artifactId ---- <artifactId>${artifactId}-parent</artifactId>

      module artifactId ---- <artifactId>${rootArtifactId}-module</artifactId>

      Steps to reproduce this problem using demo-archetype:

      1] unzip demo-archetype.zip and build it (mvn install) to install in ~/.m2/repository.
      2] Create a project from the demo-archetype using 2.0-alpha-4:
      mvn org.apache.maven.plugins:maven-archetype-plugin:2.0-alpha-4:generate
      3] Note that in the sub-module the parent artifactId is correct for the associated parent.
      4] Then create a project from the demo-archetype using 2.0-alpha-5:
      mvn org.apache.maven.plugins:maven-archetype-plugin:2.0-alpha-5:generate
      5] Note that in this project sub-module the parent artifactId is NOT correct for the associated parent.

      For example, for a project whose input artifactId = purchase-order, the following results are obtained for the parent/module artifactIds in the respective cases:

      (A)** WITH 2.0-alpha-4 (correct results):
      parent coordinates are [org.foo:purchase-order-parent:1.0-SNAPSHOT]
      and
      sub-module coordinates are [org.foo:purchase-order-module:1.0-SNAPSHOT]

      • parent coordinates in sub-module are [org.foo:purchase-order-parent:1.0-SNAPSHOT]

      (B)** WITH 2.0-alpha-5 (incorrect results):
      parent coordinates are [org.foo:purchase-order-parent:1.0-SNAPSHOT]
      and
      sub-module coordinates are [org.foo:purchase-order-module:1.0-SNAPSHOT]

      • parent coordinates in sub-module are [org.foo:purchase-order:1.0-SNAPSHOT]

      In case (B) the '-parent' portion of the parent artifactId is missing. Instead of using the actual rootArtifactId (purchase-order-parent), the 'entered' artifactId is being used (purchase-order).

      The second case (B) will not build because the parent artifactId in the sub-module is not correct for the respective parent.

      Attachments

        1. demo-archetype.zip
          15 kB
          Pat Podenski

        Issue Links

          Activity

            People

              Unassigned Unassigned
              stug23 Pat Podenski
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: