ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Weintraub" <qazw...@gmail.com>
Subject Re: AW: antrc & ant.conf files
Date Wed, 21 May 2008 03:02:11 GMT
It appears that the $HOME/.ant/ant.conf and $HOME/.antrc files are
just two different ways to do the same thing. $HOME/.ant/ant.conf is
executed firsrt, so if something is defined in both files, only the
one in $HOME/.antrc is used. However, this isn't a feature as much as
someone has to be executed first and someone last.

Use either $HOME/.antrc or $HOME/.ant/ant.conf, but not both.
Standardize on one. Setting ANT_HOME in one of these files will set
ANT_HOME by the time it needs to be used in line 123 when ANT_LIB gets
set.

Note that the shell script will assume ANT_HOME will be the location
of the shell script "ant" command if you don't have ANT_HOME set.

You can use the following syntax to set ANT_HOME only if ANT_HOME
isn't already set:

if [ -n "$ANT_HOME" ]
then
    ANT_HOME=/usr/local/ant
fi

You can pass unexported environment variables in ANT by using the following:

ant -Dmy.variable=$MY_VARIABLE

This sets the ant property ${my.variable} to the value of the
environment variable $MY_VARIABLE


On Tue, May 20, 2008 at 2:06 PM, David J. B. Hollis
<dhollis@aandoconsultancy.ltd.uk> wrote:
> Hi, David
>
> Ironically, the one which ISN'T exported, DITA_HOME, IS used in the Ant
> builds. But it's passed as parameter dita.dir. Obviously anything on
> ANT_ARGS is passed, so ought not need exporting as well. I don't think the
> others are, but I know the builds pick up the environment.
>
> The DITA toolkit actually uses Ant to build documentation in various
> formats: html, help formats and PDF. So there's no software compiling at
> all. (This might also explain why I'm asking basic questions! ;-)  )
>
> Whilst pondering this, it begged the question about whether ANT_HOME ought
> to be in .antrc or ant.conf, or not. If you've modified the system path in
> some way, or used symlinks on *nix, so that Ant can be called from anywhere,
> then it's probably a good idea to define ANT_HOME in one or other of these
> files.
>
> However, if you're running a batch script which sets the path at run time,
> then that might set up ANT_HOME as part of the process of setting up the Ant
> environment before calling Ant. In which case, it would be superfluous!
>
> Many thanks,
> David
>
>
>> On Tue, May 20, 2008 at 3:05 AM, David J. B. Hollis
>> <dhollis@aandoconsultancy.ltd.uk> wrote:
>>>
>>> I've ended up with this in an ant.conf file:
>>>
>>> #!/bin/sh
>>>
>>> DITA_HOME=~/DITA-OT1.4.2.1
>>> DITA_HOME=`cd "$DITA_HOME" && pwd`
>>>
>>> #export ANT_HOME="$DITA_HOME"/tools/ant
>>> export ANT_HOME=/Developer/Java/Ant
>>> export ANT_OPTS="-Xmx512m"
>>> export ANT_ARGS="-lib $DITA_HOME/lib -Ddita.dir=$DITA_HOME"
>>>>
>>> Are you saying I don't need to export any of these? I can just define
>>> them?
>>
>> The ANT_HOME, DITA_HOME, ANT_OPTS, and ANT_ARGS will be available
>> throughout the whole /usr/bin/ant shell script where they are used to
>> start a Java process that executes Ant. If these variables are only
>> used for starting up Ant, they do not need to be exported.
>>
>> However, once that Java process starts up, these environment variables
>> won't be available. So, they will not be available in your Java
>> process NOR (more importantly) in your build.xml file. That also means
>> any environment variables that you're depending upon for your <java>
>> or <javac> tasks will only be available if exported.
>>
>> --
>> David Weintraub
>> qazwart@gmail.com
>
> ---------------------------------------------------------------------
> 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