You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Benjamin Marwell (Jira)" <ji...@apache.org> on 2020/12/23 20:24:00 UTC

[jira] [Updated] (ARCHETYPE-490) Required property default value incorrect when using system property

     [ https://issues.apache.org/jira/browse/ARCHETYPE-490?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Benjamin Marwell updated ARCHETYPE-490:
---------------------------------------
    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:
{code:xml}
<requiredProperty key="artifactPackage">
  <defaultValue>${artifactId.replace("-", "_")}</defaultValue>
</requiredProperty>{code}
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.

  was:
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.


> Required property default value incorrect when using system property
> --------------------------------------------------------------------
>
>                 Key: ARCHETYPE-490
>                 URL: https://issues.apache.org/jira/browse/ARCHETYPE-490
>             Project: Maven Archetype
>          Issue Type: Bug
>          Components: Generator, Plugin
>    Affects Versions: 2.3, 2.4
>            Reporter: Christopher Rowland
>            Priority: Major
>              Labels: easyfix, newbie, patch
>         Attachments: ARCHETYPE-490.patch
>
>
> 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:
> {code:xml}
> <requiredProperty key="artifactPackage">
>   <defaultValue>${artifactId.replace("-", "_")}</defaultValue>
> </requiredProperty>{code}
> 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.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)