ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Vogel <pvo...@arsin.com>
Subject RE: how to set environment variable
Date Tue, 15 May 2001 00:28:29 GMT
> The <env> element will add the variable to the exvironment, or replace its
> original value. Since in most circumstances processes will 
> not even be able
> to start without something in the environment, with 
> "something" being OS
> dependant, it makes very little sense to ask for an empty environment.

That was my thinking as well, which is why the docs concerned me...

> 
> The last version I know of this code will obtain the current 
> environment
> from the system and then use those values (with any 
> modifications you make)
> to create the new environment).

That's the way I read it as well, though it does appear that there is a 
"newenvironment" attribute that can be set on a task that seems to genuinely
clear the env, for those occasions where that might be useful :-)
 
> > Personally, I think environment management is one of those 
> things that
> > needs some significant improvement in ant and I began some 
> hacking on
> > that very concept on Friday.  Basically, what I'm thinking of right
> > now (for ease of implementation) is another attribute on a
> > property tag
> > called "export" if that property should be exported to the
> > environment of
> > all processes.  I'll let you know how it goes...
> >
> 
> This sound like magic/invisible properties to me. Shouldn't 
> this be done
> using templates?

Depends on what you mean by templates.  There's nothing "invisible"
or "magic" about it.  You define a property in the "init" target and
specify that it should be exported to the environment of ant, if anything,
it is MORE visible than the current batch file with a bunch of sets calls
ant model which is what I would call *magic* and *invisible* AFAIAC.

An even "better" model would allow something like the pathrefs that exist
now, something like this:

<project ...>
   <env id="project.env1">
       <property name="foo" value="bar"/>
       <property name="JAVA_HOME" value="c:/jdk1.2.2"/>
       <classpath id="project.classpath">
	     <pathelement path="${classpath}"/>
	     <pathelement location="${oracle}/jdbc/lib/classes12.zip"/>   
       </classpath> 
   </env>
    ...

    <target ...>
        <javac srcdir="${src}" destdir="${classes}" envref="project.env"/> 
    </target>

    ...
</project>


Neat and sweet.  Unfortunately, I'm not yet intimate with Ant 1.3's source
to do
it myself, while I can do the "export" attribute on a property easily.

-Peter

> >
> > > -----Original Message-----
> > > From: robby [mailto:zengzhon@yahoo.com]
> > > Sent: Monday, May 14, 2001 1:25 AM
> > > To: ant-user@jakarta.apache.org
> > > Subject: how to set environment variable
> > >
> > >
> > > Hi all,
> > >
> > >      I'm a new user of ant, just want to know what the tag i need
> > > to use to set an environment variable in windows. it works just
> > > as typing
> > >          set a=b
> > > in Dos prompt.
> > >      Can anyone help me? thanks.
> > >
> > > robby
> > >
> > >
> > > _________________________________________________________
> > > Do You Yahoo!?
> > > Get your free @yahoo.com address at http://mail.yahoo.com
> > >
> >
> 

Mime
View raw message