ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oliver Schrenk <oliver.schr...@gmail.com>
Subject Re: Problems resolving paths in copy's "tofile" when combining multiple properties
Date Wed, 03 Mar 2010 19:51:09 GMT
Ouch. You are right of course.

Good thing is that I learned about the difference about "value" and "location", even If I
had to learn it the hard way through public humiliation.

Thanks for taking the time.

Am 03.03.2010 um 17:01 schrieb Antoine Levy Lambert:

> Hello Oliver,
> 
> on mac, because mac is a UNIX like system,
> 
> <property name="properties-path"
> location="/acme/servlet/messages.properties" />
> 
> gets expanded to /acme/servlet/messages.properties
> 
> because of the leading slash, ant thinks that /acme/servlet/messages.properties is an
absolute path and should not be resolved.
> 
> In fact your error is to use the attribute location instead of value when you define
a relative path.
> 
> Maybe the behavior of ant is a surprise to you but it is working as expected from the
Ant's developers.
> 
> Regards,
> 
> Antoine
> 
> 
> 
> Oliver Schrenk wrote:
>> I solved my problem by using two properties, one for "file" and one for
>> "tofile"
>> 
>> I wonder though why the original approach works on Mac platform but not on
>> windows. There are different two behaviours:
>> 
>> 
>> 
>> 1.MAC: multiple properties in "tofile" are first resolved, concatenated and
>> then converted to a path using basedir
>> 2.WINDOWS: multiple properties in "tofile" are each converted to a path
>> against basedir, then concatenated and again converted to a path using
>> basedir
>> 
>> While I can understand the error, there has to be consistency along all
>> platforms. The more I think about it, the moreI think of it as a bug
>> 
>> 
>> 2010/3/3 Antoine Levy Lambert <antoine@gmx.de>
>> 
>>  
>>> Oliver Schrenk wrote:
>>> 
>>>    
>>>> Here is an excerpt from the build file:
>>>> 
>>>> <project name="Project" default="preview" basedir=".">
>>>> 
>>>> <property name="build" location="build" />
>>>> <property name="classes" location="${build}/classes" />
>>>> <property name="properties-path"
>>>> location="/acme/servlet/messages.properties" />
>>>> 
>>>> <!-- snip -->
>>>> 
>>>> <target name="compile" depends="init" description="compile the source
">
>>>> <!-- Next line is line 86 -->
>>>> <copy file="${properties-path}" tofile="${classes}${properties-path}"
/>
>>>> <!-- snip -->
>>>> </target>
>>>> <!-- snip -->
>>>> </project>
>>>> 
>>>> 
>>>> 
>>>> 
>>>>      
>>> ...
>>> 
>>> Is this a known issue, expected behavior or just bland misuse of
>>>    
>>>> properties
>>>> on my part?
>>>> 
>>>> 
>>>>      
>>> change just this line
>>> 
>>> <property name="properties-path"
>>> value="/acme/servlet/messages.properties" />
>>> 
>>> when you use the <property location=""/> idiom, the property is converted
>>> to an absolute path. ${classes} is also an absolute path.
>>> 
>>> 
>>> Best regards
>>>    
>>>> Oliver Schrenk
>>>> 
>>>> 
>>>> 
>>>>      
>>> Regards,
>>> 
>>> Antoine
>>> 
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>>> For additional commands, e-mail: user-help@ant.apache.org
>>> 
>>> 
>>>    
>> 
>>  
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message