ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Erik Hatcher" <erikhatc...@earthlink.net>
Subject Re: environment variable
Date Sun, 12 Aug 2001 03:29:32 GMT
Charles,

I'm not sure what you mean by "include in the target".   Please elaborate on
what you are trying to accomplish.

You can do stuff like this inside a target:
<echo message="env.JAVA_HOME = ${env.JAVA_HOME}"/>

Also, I'd refrain from using properties beginning with "java." as there are
many that get pre-defined with that prefix in the System properties that Ant
picks up and provides for you automatically and you might collide if you
aren't careful (and Ant properties are immutable, so whoever sets it first
wins!).

    Erik

----- Original Message -----
From: "Charles Mégnin" <charly@theblueplanet.org>
To: <ant-user@jakarta.apache.org>
Sent: Saturday, August 11, 2001 8:09 PM
Subject: Re: environment variable


> Thanks Erik but the source of my confusion is with
> using an environment variable in a build such as:
>
> <property environment="env"/>
>
> (...)
>
> <target name="build" depends="init">
>     <mkdir dir="${java.build}"/>
>     <javac srcdir="${java.source}" destdir="${java.build}">
>     </javac>
>  </target>
>
> How do I include say ${env.JAVA_HOME}  in the target ?
> Charles
>
>
> Erik Hatcher wrote:
>
> > >From http://www.jguru.com/forums/view.jsp?EID=474002 :
> >
> > <property environment="env"/>
> >
> > provides all environment variables as Ant properties prefixed by "env.".
For
> > example, CLASSPATH would be accessible in Ant as ${env.CLASSPATH}.
> >
> > Although using CLASSPATH is just illustrative, since you could use
> > ${java.class.path} instead - but the same example applies for any other
> > environment variables you wish to access.
> >
> >     Erik
> >
> > ----- Original Message -----
> > From: "Charles Mégnin" <charly@theblueplanet.org>
> > To: <ant-user@jakarta.apache.org>
> > Sent: Saturday, August 11, 2001 7:33 PM
> > Subject: environment variable
> >
> > > Would someone have an example of how an environment
> > > variable is used in a build ? I can't seem to make any sense
> > > of the doc on property. Thanks in advance.
> > > Charles
> > >
>


Mime
View raw message