You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by David Miller <dm...@flashcom.net> on 2000/11/11 03:05:19 UTC

: where is preamble to bin/antRun set?

So I am able to get <exec> to work with the original antRun file supplied
with  my ant install (I am running in Linux), but there is something very
strange going on. If my <project> base directory is called /foo then I
*must* have the file antRun located at /foo/bin/antRun otherwise I get the
following error message:

"Execute failed: java.io.IOException: /foo/bin/antRun: not found"

This is slightly annoying since I didn't even have a /foo/bin folder in my
project to begin with. Surprisingly, with ANT_HOME set to /opt/ant, even if
I move antRun from ANT_HOME/lib (where it was originally located) straight
into ANT_HOME, the ant build still cannot find the file antRun.

I think the key question here is: Where is the preamble to bin/antRun set.
Anyone know the answer to this one? Thanks!


----- Original Message -----
From: Nathan Murphy <nm...@zucotto.com>
To: David Miller <dm...@flashcom.net>; <an...@jakarta.apache.org>
Cc: Mike Dusseault <mi...@zucotto.com>
Sent: Friday, November 10, 2000 2:16 PM
Subject: RE: <exec> command does not work


> Hello,
>
> We just experienced a similar problem.  The exec task runs either a
> batchfile or script depending on your os.  If you take a look at the
> antRun.bat (obviously for windows) and the antRun (script for not windows)
> you will see a bunch of extra things going on in the script that we
thought
> was unnecessary.  So we replaced antRun with the closest equivalent to the
> antRun.bat.
>
> #!/bin/sh
>
> (cd ${1}; ${2} ${3} ${4} ${5} ${6} ${7} ${8} ${9} )
>
> Seems to be working just fine now.
>
> --
> Zucotto Wireless Inc.
> Nathan Murphy, B.Eng Electrical
> Software Developer - LoadBuild Prime
> nmurphy@zucotto.com
> Phone:(613) 789-0090 ext. 426
> Fax:  (613) 789-0050
> http://www.zucotto.com
>
> -----Original Message-----
> From: David Miller [mailto:dmiller1@flashcom.net]
> Sent: Friday, November 10, 2000 3:17 PM
> To: ant-user@jakarta.apache.org
> Subject: Re: <exec> command does not work
>
>
> I have already set ANT_HOME . In any event, the rest of my ant script
works
> fine - the only thing that does not work is the <exec> command, and I
think
> the other stuff wouldn't work if ANT_HOME were not set already. Any other
> ideas why my <exec> command would not be working?
>
> Thanks!
>
> -David-
>
>
> ----- Original Message -----
> From: Stefan Bodewig <bo...@bost.de>
> To: <an...@jakarta.apache.org>
> Sent: Friday, November 10, 2000 12:57 AM
> Subject: Re: <exec> command does not work
>
>
> > David Miller <dm...@flashcom.net> wrote:
> >
> > > Hi,
> > >
> > > I am having trouble getting the <exec> command to run in my ant
> > > build.xml file. The following simple example:
> > >
> > > <exec dir="." executable="ls" os="Linux" output="dir.txt" />
> > >
> > > produces a java.io.IOException. (...bin/antRun: not found...)
> >
> > You'll need set the environment variable ANT_HOME to point to the
> > directory where Ant has been installed.
> >
> > Stefan
> >
>
>
>


Re: : where is preamble to bin/antRun set?

Posted by Stefan Bodewig <bo...@bost.de>.
David Miller <dm...@flashcom.net> wrote:

> $ANT_HOME is set correctly, to /opt/ant. The build.sh file I am
> using to run ant on my project launches ant using the line:
> 
> "$JAVA_HOME"/bin/java -Dant.home=. -classpath "$TEMP_CP"
> org.apache.tools.ant.Main $@

As you might know, Java cannot access environment variables. That's
why the script intended to start Ant (bin/ant not build.sh) translates
ANT_HOME into the property ant.home.

I don't know why you've written your own wrapper instead of using ant
(build.sh is only intended to build Ant, not to use Ant), change the
invocation to read -Dant.home="$ANT_HOME" instead and you should be
done.

You can use ~/.antrc with a line like

ANT_OPTS='-classpath "$TEMP_CP"'

or similar to set additional arguments to Ant on a permanent basis
(if you use ANT_HOME/bin/ant that is).

Stefan

RE: : where is preamble to bin/antRun set?

Posted by Conor MacNeill <co...@ebinteractive.com.au>.
David,

You may be better off using the ant script rather than munging build.sh. The
problem appears to be

-Dant.home=.

Since Java does not read the values of environment variables, the value of
$ANT_HOME is passed to ant by defining the property ant.home. Your script is
setting this to "." and not "/opt/ant". Try changing your script to

-Dant.home=$ANT_HOME

or use the ant script in $ANT_HOME/bin

Conor


--
Conor MacNeill
conor@cortexebusiness.com.au
Cortex eBusiness
http://www.cortexebusiness.com.au

> -----Original Message-----
> From: David Miller [mailto:dmiller1@flashcom.net]
> Sent: Tuesday, 14 November 2000 5:53
> To: ant-user@jakarta.apache.org
> Cc: bodewig@bost.de
> Subject: Re: <exec>: where is preamble to bin/antRun set?
>
>
> $ANT_HOME is set correctly, to /opt/ant. The build.sh file I am
> using to run
> ant on my project launches ant using the line:
>
> "$JAVA_HOME"/bin/java -Dant.home=. -classpath "$TEMP_CP"
> org.apache.tools.ant.Main $@
>
> to run ant, but this copy of build.sh does not override ANT_HOME.
> TEMP_CP is
> my CLASSPATH, slightly modified for running ant...
>
> Thanks for your help!
>
> -David-
>
> ----- Original Message -----
> From: Stefan Bodewig <bo...@bost.de>
> To: <an...@jakarta.apache.org>
> Sent: Monday, November 13, 2000 2:29 AM
> Subject: Re: <exec>: where is preamble to bin/antRun set?
>
>
> > David Miller <dm...@flashcom.net> wrote:
> >
> > > So I am able to get <exec> to work with the original antRun file
> > > supplied with my ant install (I am running in Linux), but there is
> > > something very strange going on. If my <project> base directory is
> > > called /foo then I *must* have the file antRun located at
> > > /foo/bin/antRun otherwise I get the following error message:
> > >
> > > "Execute failed: java.io.IOException: /foo/bin/antRun: not found"
> >
> > This is extremely strange. Ant will search for and execute
> > $ANT_HOME/bin/antRun (and does so on my Linux box BTW).
> >
> > To get the behavior you are experiencing, something must be setting
> > either ANT_HOME or the Ant property ant.home to your project's
> > basedir. I know Ant's own build.sh overrides the ANT_HOME setting and
> > sets it to ".", you're not accidently invoking this one, are you? The
> > script named ant is the one that should be used.
> >
> > Stefan
> >
>
>


Re: : where is preamble to bin/antRun set?

Posted by David Miller <dm...@flashcom.net>.
$ANT_HOME is set correctly, to /opt/ant. The build.sh file I am using to run
ant on my project launches ant using the line:

"$JAVA_HOME"/bin/java -Dant.home=. -classpath "$TEMP_CP"
org.apache.tools.ant.Main $@

to run ant, but this copy of build.sh does not override ANT_HOME. TEMP_CP is
my CLASSPATH, slightly modified for running ant...

Thanks for your help!

-David-

----- Original Message -----
From: Stefan Bodewig <bo...@bost.de>
To: <an...@jakarta.apache.org>
Sent: Monday, November 13, 2000 2:29 AM
Subject: Re: <exec>: where is preamble to bin/antRun set?


> David Miller <dm...@flashcom.net> wrote:
>
> > So I am able to get <exec> to work with the original antRun file
> > supplied with my ant install (I am running in Linux), but there is
> > something very strange going on. If my <project> base directory is
> > called /foo then I *must* have the file antRun located at
> > /foo/bin/antRun otherwise I get the following error message:
> >
> > "Execute failed: java.io.IOException: /foo/bin/antRun: not found"
>
> This is extremely strange. Ant will search for and execute
> $ANT_HOME/bin/antRun (and does so on my Linux box BTW).
>
> To get the behavior you are experiencing, something must be setting
> either ANT_HOME or the Ant property ant.home to your project's
> basedir. I know Ant's own build.sh overrides the ANT_HOME setting and
> sets it to ".", you're not accidently invoking this one, are you? The
> script named ant is the one that should be used.
>
> Stefan
>


Re: : where is preamble to bin/antRun set?

Posted by Stefan Bodewig <bo...@bost.de>.
David Miller <dm...@flashcom.net> wrote:

> So I am able to get <exec> to work with the original antRun file
> supplied with my ant install (I am running in Linux), but there is
> something very strange going on. If my <project> base directory is
> called /foo then I *must* have the file antRun located at
> /foo/bin/antRun otherwise I get the following error message:
> 
> "Execute failed: java.io.IOException: /foo/bin/antRun: not found"

This is extremely strange. Ant will search for and execute
$ANT_HOME/bin/antRun (and does so on my Linux box BTW).

To get the behavior you are experiencing, something must be setting
either ANT_HOME or the Ant property ant.home to your project's
basedir. I know Ant's own build.sh overrides the ANT_HOME setting and
sets it to ".", you're not accidently invoking this one, are you? The
script named ant is the one that should be used.

Stefan