You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Marcelo de Moraes Serpa <ce...@gmail.com> on 2006/10/16 22:05:48 UTC

Set enviroment variable with ant

I need to set the PGPASSWORD enviroment variable in a ant project, however I
don't know how could I do it... should I use the exec task?

Re: Set enviroment variable with ant

Posted by Marcelo de Moraes Serpa <ce...@gmail.com>.
Hi Antoine, thanks a lot for the reply!

I actually solved the problem using the <echo> task! I'll keep those other
possibilities in mind, they might come in handy ;)

Marcelo.

On 10/16/06, Antoine Levy-Lambert <an...@gmx.de> wrote:
>
> Hello Marcelo,
>
> setting an environment variable from ant is possible using the exec task.
> Using a nested element (see the doc). The new environment variable is only
> visible for the one particular program started by the exec task.
>
> similarly, the <java/> task can set env vars, this only when you fork java
> apps.
>
> If you need an env var to be visible to all the <exec/> and <java/>
> invocations started by an ant build, you need to set this env var before
> starting ant, for instance in a wrapper script.
>
> Regards,
>
> Antoine
> -------- Original-Nachricht --------
> Datum: Mon, 16 Oct 2006 18:05:48 -0200
> Von: "Marcelo de Moraes Serpa" <ce...@gmail.com>
> An: "Ant Users List" <us...@ant.apache.org>
> Betreff: Set enviroment variable with ant
>
> > I need to set the PGPASSWORD enviroment variable in a ant project,
> however
> > I
> > don't know how could I do it... should I use the exec task?
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>

Re: Set enviroment variable with ant

Posted by Antoine Levy-Lambert <an...@gmx.de>.
Hello Marcelo,

setting an environment variable from ant is possible using the exec task. Using a nested element (see the doc). The new environment variable is only visible for the one particular program started by the exec task.

similarly, the <java/> task can set env vars, this only when you fork java apps.

If you need an env var to be visible to all the <exec/> and <java/> invocations started by an ant build, you need to set this env var before starting ant, for instance in a wrapper script.

Regards,

Antoine
-------- Original-Nachricht --------
Datum: Mon, 16 Oct 2006 18:05:48 -0200
Von: "Marcelo de Moraes Serpa" <ce...@gmail.com>
An: "Ant Users List" <us...@ant.apache.org>
Betreff: Set enviroment variable with ant

> I need to set the PGPASSWORD enviroment variable in a ant project, however
> I
> don't know how could I do it... should I use the exec task?

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