[ http://jira.codehaus.org/browse/MNG-1422?page=comments#action_50446 ] 

Michal Stochmialek commented on MNG-1422:
-----------------------------------------

I've got additional testcase. 

<tasks>
        <property name="property1" value="value"/>
        <property name="property2" value="${property1}"/>
        <property name="property3" value="prefix ${property1}"/>
                                                                
        <echo>P1: ${property1}</echo>
        <echo>P2: ${property2}</echo>
        <echo>P3: ${property3}</echo>

        <echo message="P1: ${property1}"/>
        <echo message="P2: ${property2}"/>
        <echo message="P3: ${property3}"/>

        <echo message="${property1}"/>
        <echo message="${property2}"/>
        <echo message="${property3}"/>
</tasks>

And it produces:

[INFO] Executing tasks
     [echo] P1: value
     [echo] P2: value
     [echo] P3: prefix null
     [echo] P1: null
     [echo] P2: null
     [echo] P3: null
     [echo] value
     [echo] value
     [echo] prefix null
[INFO] Executed tasks

As you see resolving properties in attributes doesn't work only when there is a 
prefix before property reference (${prop}). 
"${property}" - WORKS
"pre ${property}" - NOT

I'm attaching pom.xml


> antrun: properties not resolved in attributes
> ---------------------------------------------
>
>          Key: MNG-1422
>          URL: http://jira.codehaus.org/browse/MNG-1422
>      Project: Maven 2
>         Type: Bug
>   Components: maven-antrun-plugin
>     Versions: 2.0
>  Environment: windows xp pro
>     Reporter: Michal Stochmialek

>
>
> I found strange behavior of antrun plugin. I believe that properties are not 
> resolved correctly in attributes content. For example <echo> task is 
> producing different output depending on place where property is used. When 
> property is used in tag body, the result is correct. But when used in 
> attributes the result contains 'null's.
> I've tested it on example below.
> <plugin>
>         <artifactId>maven-antrun-plugin</artifactId>
>         <executions>
>                 <execution>
>                         <phase>package</phase>
>                         <configuration>
>                                 <tasks>
>                                         <property name="destdir"
>                                         
> location="${maven.build.directory}/jarInEar"/>
>                                         #  Those two lines below produce 
> different output
>                                         <echo>1: ${destdir}</echo>
>                                         <echo message="2: ${destdir}" />
>                                 </tasks>
>                         </configuration>
>                         <goals>
>                                 <goal>run</goal>
>                         </goals>
>                 </execution>
>         </executions>
> </plugin>
> [INFO] [antrun:run {execution: default}]
> [INFO] Executing tasks
> [DEBUG] getProperty(ns=null, name=ant.reuse.loader, user=false)
> [DEBUG] getProperty(ns=null, name=destdir, user=false)
>      [echo] 1: P:\projects\endpoint\target\jarInEar
>      [echo] 2: null
> [INFO] Executed tasks
> This bug prevents from using properties in general, since almost most task's 
> arguments are applied using arguments. 

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to