You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by T Master <tm...@iknowledgeinc.com> on 2001/08/01 21:40:45 UTC

[antlist] property values and command line arguments

Target "foo" requires property value "bar".
Property "bar" is meant to be specified through the command line.
However, I want to provide a default value in target "init".  Is this valid?

Is there precendence of one over the other?  Would the command line value
overwrite the default as desired?

T Master


RE: [antlist] property values and command line arguments

Posted by Conor MacNeill <co...@cortexebusiness.com.au>.
y values and command line arguments
>
>
> Target "foo" requires property value "bar".
> Property "bar" is meant to be specified through the command line.
> However, I want to provide a default value in target "init".  Is
> this valid?

You don't need to put this in an init target. Just in the project will do

<project>
  <property name="bar" value="a"

  <target name="foo">
...

>
> Is there precendence of one over the other?

Sort of. First to set the value wins.

> Would the command line value
> overwrite the default as desired?
>

Yes, command line goes first, followed by non-target properties, followed by
properties within targets as the targets are evaluated.

ant -Dbar=b

will result in bar have the value b. This command line precedence is one of
the motivations for immutable properties.

Conor