You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Alan Snyder <co...@cbfiddle.com> on 2020/12/19 21:45:31 UTC
a tricky case of running an executable from an ant build script
I have an ant script that runs an executable without specifying the full path of the executable.
If I run ant from the shell, then it finds the executable on my $PATH, which is what I want.
(I do not specify searchpath=“true”, so perhaps I do not understand what that does, or
the documentation is wrong.)
The case of interest is where I perform the build directly within a Java application process.
When I do this, the $PATH that the build script sees is the $PATH of the application, and presumably
that is the $PATH that is used to find the executable.
Unfortunately, if my application is a bundled macOS application, it has a minimal $PATH:
/usr/bin:/bin:/usr/sbin:/sbin
Is there a way that within my application I can configure ant with a different $PATH to provide
to the build script, so that it will find the executable?
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
Re: a tricky case of running an executable from an ant build script
Posted by Stefan Bodewig <bo...@apache.org>.
On 2020-12-19, Alan Snyder wrote:
> The case of interest is where I perform the build directly within a Java application process.
[...]
> Is there a way that within my application I can configure ant with a
> different $PATH to provide to the build script, so that it will find
> the executable?
Depends on the way you execute the build. If you are using Runtime.exec
or ProcessBuilder there are ways to specify a custom environment for the
forked process. If you are invoking Ant via its Java API then there is
no way I can think of right now.
Stefan
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
Re: a tricky case of running an executable from an ant build script
Posted by Alan Snyder <co...@cbfiddle.com>.
That’s not the point. I don’t want to change the build script, I want to change the environment in which it is run.
> On Dec 24, 2020, at 12:48 PM, <ap...@materne.de> <ap...@materne.de> wrote:
>
> If you know where the executable is located, you could set the "executable" attribute of <exec>.
> Or set the "dir" attribute tot he directory containing the executable you want to start.
> Or provide a nested <env key="Path" .../> element.
>
> Jan
>
> -----Ursprüngliche Nachricht-----
> Von: Alan Snyder <co...@cbfiddle.com>
> Gesendet: Samstag, 19. Dezember 2020 22:46
> An: Ant Users List <us...@ant.apache.org>
> Betreff: a tricky case of running an executable from an ant build script
>
> I have an ant script that runs an executable without specifying the full path of the executable.
>
> If I run ant from the shell, then it finds the executable on my $PATH, which is what I want.
> (I do not specify searchpath=“true”, so perhaps I do not understand what that does, or the documentation is wrong.)
>
> The case of interest is where I perform the build directly within a Java application process.
> When I do this, the $PATH that the build script sees is the $PATH of the application, and presumably that is the $PATH that is used to find the executable.
>
> Unfortunately, if my application is a bundled macOS application, it has a minimal $PATH:
> /usr/bin:/bin:/usr/sbin:/sbin
>
> Is there a way that within my application I can configure ant with a different $PATH to provide to the build script, so that it will find the executable?
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org For additional commands, e-mail: user-help@ant.apache.org
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
AW: a tricky case of running an executable from an ant build script
Posted by ap...@materne.de.
If you know where the executable is located, you could set the "executable" attribute of <exec>.
Or set the "dir" attribute tot he directory containing the executable you want to start.
Or provide a nested <env key="Path" .../> element.
Jan
-----Ursprüngliche Nachricht-----
Von: Alan Snyder <co...@cbfiddle.com>
Gesendet: Samstag, 19. Dezember 2020 22:46
An: Ant Users List <us...@ant.apache.org>
Betreff: a tricky case of running an executable from an ant build script
I have an ant script that runs an executable without specifying the full path of the executable.
If I run ant from the shell, then it finds the executable on my $PATH, which is what I want.
(I do not specify searchpath=“true”, so perhaps I do not understand what that does, or the documentation is wrong.)
The case of interest is where I perform the build directly within a Java application process.
When I do this, the $PATH that the build script sees is the $PATH of the application, and presumably that is the $PATH that is used to find the executable.
Unfortunately, if my application is a bundled macOS application, it has a minimal $PATH:
/usr/bin:/bin:/usr/sbin:/sbin
Is there a way that within my application I can configure ant with a different $PATH to provide to the build script, so that it will find the executable?
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org For additional commands, e-mail: user-help@ant.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org