ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Antoine Levy Lambert <anto...@gmx.de>
Subject Re: Problems resolving paths in copy's "tofile" when combining multiple properties
Date Wed, 03 Mar 2010 16:01:10 GMT
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


Mime
View raw message