You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Patrick Surry <pd...@quadstone.com> on 2004/01/14 22:54:24 UTC
Command-line property overrides with 'location' semantics?
It seems like specifying a property at the command-line via -D always uses
'value' semantics, even if the property is declared in the project with
'location' semantics. For example, on a windows machine with this project:
<?xml version="1.0"?>
<project name="parameters" default="all" basedir=".">
<property name="foo" value="c:/some/filename.txt"/>
<property name="bar" location="c:/some/othername.txt"/>
<target name="all">
<echo message="foo = [${foo}] and bar = [${bar}]"/>
</target>
</project>
So plain 'ant' gives:
[echo] foo = [c:/some/filename.txt] and bar = [C:\some\othername.txt]
but 'ant -Dbar=/a/b/c' gives:
[echo] foo = [c:/some/filename.txt] and bar = [/a/b/c]
i.e. it's not converting bar as a location anymore.
Is there any way around this other than re-converting the property in the plan
(ie. <property name="bar2" location="${bar}"/> ) ?
Thanks,
Patrick
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
Re: Command-line property overrides with 'location' semantics?
Posted by Peter Reilly <pe...@corvil.com>.
You are correct.
The "declaration" in the build script is ignored as the property has
already been defined,
so it has "value" semantics.
Peter
Patrick Surry wrote:
> It seems like specifying a property at the command-line via -D always
> uses 'value' semantics, even if the property is declared in the
> project with 'location' semantics. For example, on a windows machine
> with this project:
>
> <?xml version="1.0"?>
> <project name="parameters" default="all" basedir=".">
> <property name="foo" value="c:/some/filename.txt"/>
> <property name="bar" location="c:/some/othername.txt"/>
> <target name="all">
> <echo message="foo = [${foo}] and bar = [${bar}]"/>
> </target>
> </project>
>
> So plain 'ant' gives:
>
> [echo] foo = [c:/some/filename.txt] and bar = [C:\some\othername.txt]
>
> but 'ant -Dbar=/a/b/c' gives:
>
> [echo] foo = [c:/some/filename.txt] and bar = [/a/b/c]
>
> i.e. it's not converting bar as a location anymore.
>
> Is there any way around this other than re-converting the property in
> the plan (ie. <property name="bar2" location="${bar}"/> ) ?
>
> Thanks,
> Patrick
>
>
>
>
> ---------------------------------------------------------------------
> 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