ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Weintraub <qazw...@gmail.com>
Subject Re: ANT Property substutition in log4j.properties
Date Thu, 10 Dec 2009 16:59:46 GMT
Have you tried exporting the environment variables? Try exporting
ANT_ARGS and see if that works.

In Unix, if you don't export an environment variable, it doesn't get
pushed to the subshell. Windows doesn't have this. In Windows, all
variables are available in each subshell.

Try to create a simple build.xml script, so you can use for experimenting:

<project>
    <property environment="ENV"/>
    <echo>The value of ANT_OPTS is ${ENV.ANT_OPTS}</echo>
    <echo>The value of work.dir is ${work.dir}</echo>
</project>

Then, you can try things like this:

$ ANT_OPTS=-Dwork.dir=barfoo
$ ant
Buildfile: build.xml
     [echo] The value of ANT_OPTS is ${ENV.ANT_OPTS}
     [echo] The value of work.dir is ${work.dir}

BUILD SUCCESSFUL
Total time: 0 seconds
$ export ANT_OPTS
$ ant
Buildfile: build.xml
     [echo] The value of ANT_OPTS is -Dwork.dir=barfoo
     [echo] The value of work.dir is barfoo

BUILD SUCCESSFUL
Total time: 0 seconds

That will allow you to play with various aspects of ant, and see where
the problem could be coming from.

You can also use "set -vx" to help debug your shell scripts. You can
try putting that in /bin/ant (which is a shell script or points to the
shell script that Ant uses. This way, you see each line as it executes
and understand what is happening to the values (for example ANT_OPTS
isn't exported. Therefore, the Ant shell script isn't getting the
value).


On Wed, Dec 9, 2009 at 11:04 AM, Jim Garrison <Jim.Garrison@troux.com> wrote:
>> -----Original Message-----
>> From: Antoine Levy Lambert [mailto:antoine@gmx.de]
>> Sent: Wednesday, December 09, 2009 6:43 AM
>> To: Ant Users List
>> Subject: Re: ANT Property substutition in log4j.properties
>>
>> Hello Jim,
>>
>> log4j understands system properties, not ant properties.
>>
>> So most likely these ANT_ARGS on linux do not set a system property
>> but
>> just an ant property. System properties are copied to ant
>> properties,
>> but the reverse is not true.
>>
>> Using ANT_OPTS=-Dwork.dir=somepath should work on both Windows and
>> Linux.
>
> I tried that also, with the same results.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>



-- 
David Weintraub
qazwart@gmail.com

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


Mime
View raw message