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

Required property default value incorrect when using system property

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 2.3, 2.4
    • Fix Version/s: None
    • Component/s: Generator, Plugin
    • Labels:
    • Flags:
      Patch

      Description

      When performing a generation while passing in artifactId, groupId, or version as a system property, required property default values using velocity expressions are evaluated incorrectly.

      As an example, I have an archetype with groupId com.apache and artifactId automation-archetype. If I attempt to generate using the following command:

      mvn archetype:generate -DarchetypeGroupId=com.apache -DarchetypeArtifactId=automation-archetype -DartifactId=hello-world-automation

      And I have a required property defined as:

      <requiredProperty key="artifactPackage">
      <defaultValue>${artifactId.replace("-", "_")}</defaultValue>
      </requiredProperty>

      Then the resulting property is evaluated to automation_archetype instead of hello_world_automation.

      This changed from version 2.2 to 2.3 by a patch introduced in ARCHETYPE-397.

      Proposed additional patch is attached.

        Attachments

        1. ARCHETYPE-490.patch
          1 kB
          Christopher Rowland

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                dfsf5263 Christopher Rowland
              • Votes:
                4 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated: