[ 
https://issues.apache.org/jira/browse/ARCHETYPE-397?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16005599#comment-16005599
 ] 

Mirko Raner commented on ARCHETYPE-397:
---------------------------------------

Not sure if this warrants re-opening this ticket, or filing a new one, but here 
goes...

In my mind there are still a few things amiss in this area, for example, using 
archetype plug-in version 3.0.1:

# the {{package}} property can be used in a Velocity expression to define a 
{{<defaultValue>}} but the default value is still displayed incorrectly during 
interactive archetype instantiation (i.e., it shows the Velocity expression 
instead of the resulting expanded value) -- it does however get properly 
substituted during artifact generation
# the {{groupId}}, {{artifactId}} and {{version}} properties can be used in the 
same way, and their effective default values are displayed correctly; however, 
they resolve to the respective values for the archetype itself and are of 
limited use
# the {{rootArtifactId}} does not seem to be available at all; during archetype 
instantiation Maven displays the unexpanded expression, and the same expression 
is also literally substituted in the generated artifacts
# similarly, {{archetypeGroupId}}, {{archetypeArtifactId}} are also not 
available at all

With regards to ARCHETYPE-397, only item #1 seems directly related to this 
ticket and might warrant re-opening it. Item #2, I believe, is the same problem 
as described in ARCHETYPE-490. Items #3 and #4 seem to be covered by a comment 
on ARCHETYPE-383: 
https://issues.apache.org/jira/browse/ARCHETYPE-383?focusedCommentId=14423463&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-14423463

Any opinions on which tickets should be re-opened or whether a new ticket 
should be filed?

> Required property default value is not displayed correctly if a Velocity 
> expression
> -----------------------------------------------------------------------------------
>
>                 Key: ARCHETYPE-397
>                 URL: https://issues.apache.org/jira/browse/ARCHETYPE-397
>             Project: Maven Archetype
>          Issue Type: Bug
>          Components: Generator
>    Affects Versions: 2.2
>            Reporter: Nicolas Dupont
>            Assignee: Olivier Lamy (*$^¨%`£)
>             Fix For: 2.3
>
>         Attachments: fix_archetype_397.patch
>
>
> If you use a Velocity expression to define a default value in your archetype 
> descriptor, it is not displayed correctly when you generate a project.
> Let's say we have, in our descriptor :
> <requiredProperty key="package">${groupId}.${artifactId}</requiredProperty>
> When you generate a project from the archetype, you type com.company as a 
> groupId and my-project as an artifactId. Then you'll be prompted for the 
> package and default value will be displayed as "com.company.my-project".
> Now, if we have in our descriptor :
> {{<requiredProperty 
> key="package">${groupId}.${artifactId.replace('-','')}</requiredProperty>}}
> When you generate a project in the same way, the default value for package 
> will be displayed as ${groupId}.${artifactId.replace('-','')} instead of 
> com.company.myproject.
> Note that if you leave the value as it is, the generation will do resolve the 
> expression (package property will be resolve correctly). It's just confusing 
> when the default value is showed at the prompt step.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to