[ 
https://jira.codehaus.org/browse/ARCHETYPE-406?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=297509#comment-297509
 ] 

Bue Pierre-Christophe edited comment on ARCHETYPE-406 at 4/30/12 5:06 AM:
--------------------------------------------------------------------------

I can bring more precision.

I have attached an example of the issue. When user-defined propertes are 
specified, only the first is correctly evaluated (i think it is, but i'm not 
quite sure ...).

In the example, i ask for two properties : propA and propB. i capitalize these 
two properties, and use it in two ways : inner use (on text filtering, with 
$propA for example), and file name filtering. On both, capitalizePropA is 
correctly evaluated, but capitalizePropB is neither evaluated as propA with 
capitalizePropA.

Here is the interesting part of the archetype generation log :

Define value for property 'capitalizePropA':  
${propA.substring(0,1).toUpperCase()}${propA.substring(1)}: : 
Define value for property 'capitalizePropB':  
${propB.substring(0,1).toUpperCase()}${propB.substring(1)}: : 
Define value for property 'propA': : valA
Define value for property 'propB': : valB
Confirm properties configuration:
groupId: group
artifactId: art
version: 1.0.0-SNAPSHOT
package: group
capitalizePropA: ${propA.substring(0,1).toUpperCase()}${propA.substring(1)}
capitalizePropB: ${propB.substring(0,1).toUpperCase()}${propB.substring(1)}
propA: valA
propB: valB

For the moment, all is ok. But velocity complains on the resolution of 
capitalizePropB on effective generation : 

[INFO] 
----------------------------------------------------------------------------
[INFO] Using following parameters for creating project from Archetype: test:1
[INFO] 
----------------------------------------------------------------------------
[INFO] Parameter: groupId, Value: group
[INFO] Parameter: artifactId, Value: art
[INFO] Parameter: version, Value: 1.0.0-SNAPSHOT
[INFO] Parameter: package, Value: group
[INFO] Parameter: packageInPathFormat, Value: group
[INFO] Parameter: propA, Value: valA
30 avr. 2012 12:03:34 org.apache.velocity.runtime.log.JdkLogChute log
INFO: FileResourceLoader : adding path '.'
30 avr. 2012 12:03:34 org.apache.velocity.runtime.log.JdkLogChute log
INFO: Null reference [template 'capitalizePropB', line 1, column 1] : 
${propB.substring(0,1).toUpperCase()} cannot be resolved.
30 avr. 2012 12:03:34 org.apache.velocity.runtime.log.JdkLogChute log
INFO: Null reference [template 'capitalizePropB', line 1, column 38] : 
${propB.substring(1)} cannot be resolved.
[INFO] Parameter: capitalizePropB, Value: 
${propB.substring(0,1).toUpperCase()}${propB.substring(1)}
[INFO] Parameter: capitalizePropA, Value: ValA
[INFO] Parameter: package, Value: group
[INFO] Parameter: version, Value: 1.0.0-SNAPSHOT
[INFO] Parameter: groupId, Value: group
[INFO] Parameter: propB, Value: valB
[INFO] Parameter: artifactId, Value: art
[INFO] project created from Archetype in dir: /home/pcbue/test/plop/art
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
                
      was (Author: pcbue):
    I can bring more precision.

I have attached an example of the issue. When user-defined propertes are 
specified, only the first is correctly evaluated (i think it is, but i'm not 
quite sure ...).
                  
> Support of velocity expressions for user-defined properties
> -----------------------------------------------------------
>
>                 Key: ARCHETYPE-406
>                 URL: https://jira.codehaus.org/browse/ARCHETYPE-406
>             Project: Maven Archetype
>          Issue Type: Bug
>          Components: Plugin
>    Affects Versions: 2.x
>            Reporter: Bue Pierre-Christophe
>         Attachments: sample-archetype406.tar.gz
>
>
> Standard properties (artifactId, groupId, ...) are supported in Velocity 
> expressiosn, but still does not work with user defined properties. For 
> example:
> <requiredProperty key="a">
> <defaultValue>${artifactId}.substring(0,1).toUpperCase()</defaultValue>
> </requiredProperty>
> with artifactId=toto will give a=T, but
> <requiredProperty key="b"/>
> <requiredProperty key="a">
> <defaultValue>${b}.substring(0,1).toUpperCase()</defaultValue>
> </requiredProperty>
> with b=toto will give a=${b}.substring(0,1).toUpperCase()

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://jira.codehaus.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to