You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Bill Clinton <bc...@snipermail.com> on 2001/06/26 01:33:02 UTC
Can ant read environment variables?
Hello,
I have read in the ant documentation that build files have access
to environment variables, but I am unable to get this to work. In my
.bashrc, I have:
WEBAPP=/usr/local/resin-1.2.7/webapps
export WEBAPP
and when I type "env" I see that this has been set. In my build.xml, I
have the following two lines:
<property name="webapp.home" value="${WEBAPP}"/>
<property name="deploy.home" value="${webapp.home}/test"/>
I then use "deploy.home" to copy files etc. But when I build, I get the
following:
[copy] Copying 11 files to /home/bclinton/work/test/${WEBAPP}/test/WEB-INF
It is creating a directory in my basedir called ${WEBAPP} and copying
files there. Not exactly what I had in mind. If I set "webapp.home" to
an absolute path, it works fine. But I would like it so that the same
buildfile can be used by multiple developers, who would specify
differences with environmental variables.
Can someone please point out what I am doing wrong here? Or if this is
a known problem?
One more question: I would have liked to research this question some
more before asking: is there an archive of the ant-user list? I
couldn't find one, and I have only been subscribed for around three weeks.
Thanks,
Bill
Re: Can ant read environment variables?
Posted by Diane Holt <ho...@yahoo.com>.
--- Bill Clinton <bc...@snipermail.com> wrote:
> I have read in the ant documentation that build files have access
> to environment variables, but I am unable to get this to work.
As of 1.3, you can use:
<property environment="env"/>
or any other prefix you prefer instead of "env". You can then reference
your environment variables using ${env.VARNAME} (or whatever prefix you've
chosen to use. See the Property task description in the user manual for
more details.
> One more question: I would have liked to research this question some
> more before asking: is there an archive of the ant-user list? I
> couldn't find one, and I have only been subscribed for around three
> weeks.
There are links to the mailing-list archives at the bottom of the Ant
home-page:
http://jakarta.apache.org/ant/
Diane
=====
(holtdl@yahoo.com)
__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/
RE: Can ant read environment variables?
Posted by Conor MacNeill <co...@cortexebusiness.com.au>.
Bill,
Have a read of
http://jakarta.apache.org/ant/manual/CoreTasks/property.html
You have to load the environment values - they are not available
automatically. Check out the environment attribute, in particular.
Conor
> -----Original Message-----
> From: Bill Clinton [mailto:bclinton@snipermail.com]
> Sent: Tuesday, 26 June 2001 9:33 AM
> To: ant-user@jakarta.apache.org
> Subject: Can ant read environment variables?
>
>
> Hello,
> I have read in the ant documentation that build files have access
> to environment variables, but I am unable to get this to work. In my
> .bashrc, I have:
>
> WEBAPP=/usr/local/resin-1.2.7/webapps
> export WEBAPP
>
> and when I type "env" I see that this has been set. In my build.xml, I
> have the following two lines:
>
> <property name="webapp.home" value="${WEBAPP}"/>
> <property name="deploy.home" value="${webapp.home}/test"/>
>
> I then use "deploy.home" to copy files etc. But when I build, I get the
> following:
>
> [copy] Copying 11 files to /home/bclinton/work/test/${WEBAPP}/test/WEB-INF
>
> It is creating a directory in my basedir called ${WEBAPP} and copying
> files there. Not exactly what I had in mind. If I set "webapp.home" to
> an absolute path, it works fine. But I would like it so that the same
> buildfile can be used by multiple developers, who would specify
> differences with environmental variables.
>
> Can someone please point out what I am doing wrong here? Or if this is
> a known problem?
>
> One more question: I would have liked to research this question some
> more before asking: is there an archive of the ant-user list? I
> couldn't find one, and I have only been subscribed for around three weeks.
>
> Thanks,
> Bill
>
>
>
>
>