You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by "Michael O. Duffy" <md...@snet.net> on 2000/11/10 01:57:41 UTC

Where Can I Find The JUnit Task Implementation?

I downloaded the source code today and rebuilt Ant.  I was excited when
I read the docs, because there was a new JUnit task tag.  But when I
tried to use it, I found that the default.properties file didn't have a
junit task registered.  The .jar files didn't turn up a class file to
implement one.

Can someone tell me where I can find the Java code to implement the
junit task?  I figure there's a good one out there, since a task tag
exists.  Or is that a sign that someone should be working on an
implementation?

I'm new to this, so please forgive my ignorance.  I've only learned how
to use Ant this week, but I already love it.  I'm looking forward to
scripting builds and JUnit tests together.  Thank you - MOD



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

: where is preamble to bin/antRun set?

Posted by David Miller <dm...@flashcom.net>.
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: command does not work

Posted by Nathan Murphy <nm...@zucotto.com>.
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: command does not work

Posted by David Miller <dm...@flashcom.net>.
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: command does not work

Posted by Stefan Bodewig <bo...@bost.de>.
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

command does not work

Posted by David Miller <dm...@flashcom.net>.
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...)

I am running ant version 1.2 on redhat linux 7. Everything else works great.
I actually want to do something more complicated with <exec> (datestamp my
jar'ed output and create a soft link to the successful build from within the
ant script for archiving purposes, which would require a much more
complicated, many worded "executable" command...)

Any help is greatly appreciated! Thanks,

-David-



Re: Where Can I Find The JUnit Task Implementation?

Posted by Stefan Bodewig <bo...@bost.de>.
Michael O. Duffy <md...@snet.net> wrote:

> I downloaded the source code today and rebuilt Ant.  I was excited
> when I read the docs, because there was a new JUnit task tag.  But
> when I tried to use it, I found that the default.properties file
> didn't have a junit task registered.

Did Ant say it couldn't find <junit> or do you mean you've looked at
src/main/org/apache/tools/ant/taskdefs/defaults.properties and it
wasn't defined there.

In the first case, follow Conor's advice, add junit.jar to you
CLASSPATH (requires JUnit 3.x, maybe you have an older version of
JUnit? See <http://www.junit.org>) and recompile.

In the later case the sources you have grabbed are the sources of Ant
1.1, not of 1.2 or even the current ones.

Stefan

RE: Where Can I Find The JUnit Task Implementation?

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

You need to have the junit jar in your classpath when you build ant. If this
is true the junit task will be compiled and added to the ant.jar.

You will notice that the ant build script itself includes some junit tests.

Conor


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

> -----Original Message-----
> From: Michael O. Duffy [mailto:mduffy01@snet.net]
> Sent: Friday, 10 November 2000 11:58
> To: ant-user@jakarta.apache.org
> Subject: Where Can I Find The JUnit Task Implementation?
>
>
>
> I downloaded the source code today and rebuilt Ant.  I was excited when
> I read the docs, because there was a new JUnit task tag.  But when I
> tried to use it, I found that the default.properties file didn't have a
> junit task registered.  The .jar files didn't turn up a class file to
> implement one.
>
> Can someone tell me where I can find the Java code to implement the
> junit task?  I figure there's a good one out there, since a task tag
> exists.  Or is that a sign that someone should be working on an
> implementation?
>
> I'm new to this, so please forgive my ignorance.  I've only learned how
> to use Ant this week, but I already love it.  I'm looking forward to
> scripting builds and JUnit tests together.  Thank you - MOD
>
>
>