You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Steven Harms <st...@gmail.com> on 2010/06/06 00:19:52 UTC

Trying to get Ant + JUnit working peaceably

Hello,

I'm attempting to learn Java at present and needed to add some
automation around my build and test cycle.  Coming from Ruby, I've got
a real test-first design discipline.

When I attempted to make a <junit> task call, I started getting this
error (I can hear eyes rolling...).


BUILD FAILED
/Users/stharms/java_card/build.xml:38: Problem: failed to create task
or type junit
Cause: the class
org.apache.tools.ant.taskdefs.optional.junit.JUnitTask was not found.
        This looks like one of Ant's optional components.
Action: Check that the appropriate optional JAR exists in
        -/usr/local/apache-ant-1.8.0/lib
        -/Users/stharms/.ant/lib
        -a directory added on the command line with the -lib argument

OK, I'm open to trying to step through the directions.

Most searches and archives suggested that it was paramount to make
sure that the junit library was in $ANTDIR/lib.

In this directory I have both:

junit-3.8.2.jar : retrieved with ant -f fetch.xml -Ddest=system
junit-4.9-SNAPSHOT-20100512-0041.jar : built from github

I then thought, OK let's go with the instructions strictly, what's in
the lib/optional subdir.  Nothing!  OK, so I used the fetch.xml task
to pull the jars into optional.

Re-try, same error.

OK, IRC.  A kind soul there pointed out that on his debian system this
class file was part of optionals.jar that "just worked" as part of
using apt-get ant-optionals.  Hm, regrettably that answer isn't
portable to my platform.

So, I'm stuck.  Can anyone help me get around this low point.  I'm
excited to start programming Java, but I've wound up programming Ant
most of the day -- not a bad thing, just not the shiny app I had
dreamt of :)

Thanks in advance, mysterious guru with the answer,

Steven

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


[RESOLVED] Re: Trying to get Ant + JUnit working peaceably

Posted by Steven Harms <st...@gmail.com>.
I went back to my /usr/local/src/apache-ant....

1.  Used the fetch.xml script to retrieve all the 3rd party components
and put them into lib/optional
2.  Re-built ant
3.  Verified that $ANTDIR/lib/optional had ant-junit in there
4.  jar tf ant-junit ... it was BIG this time and included JUnitTask

After that I was able to get the junit task to function.

On Sat, Jun 5, 2010 at 6:13 PM, Steven Harms <st...@gmail.com> wrote:
> Shawn,
>
> Thanks for your suggestions and for your prompt reply.
>
>> The junit jar is responsible for junit itself, NOT the ability to run junit from ant.  In order to run junit > from ant, you also need the ant-junit.jar in the $ANTHOME/lib directory.  This should be part of
>> the normal installation of ant so I am not sure why it isn't working for you.
>
> I can confirm that ant-junit.jar is present:
>
> $ pwd
> /usr/local/apache-ant-1.8.0/lib
> $ ls -l ant-junit.jar
> -rw-r--r--  1 stharms  everyone  12736 May  2 11:10 ant-junit.jar
>
> Here are the jar's contents:
>
> jar tf ant-junit.jar |more
> META-INF/
> META-INF/MANIFEST.MF
> org/
> org/apache/
> org/apache/tools/
> org/apache/tools/ant/
> org/apache/tools/ant/taskdefs/
> org/apache/tools/ant/taskdefs/optional/
> org/apache/tools/ant/taskdefs/optional/junit/
> org/apache/tools/ant/taskdefs/optional/junit/xsl/
> org/apache/tools/ant/taskdefs/optional/junit/xsl/junit-frames.xsl
> org/apache/tools/ant/taskdefs/optional/junit/xsl/junit-noframes.xsl
>
>> Since you are new to java, you may not know that you can open up any jar with a zip tool, like Winzip or winrar.  I do this a lot to inspect the contents of the jar.  If you open up ant-junit.jar, you will see that the org.apache.tools.ant.taskdefs.optional.junit.JUnitTask class is inside.
>
> Notably, in my installation that /isn't/ present!  That would explain
> the error, the question would be how do I fix my install?  I've been
> using ant pretty successfully to do work-based projects.  Should I try
> to re-build and re-configure the source?
>
> Steven
>

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


Re: Trying to get Ant + JUnit working peaceably

Posted by Steven Harms <st...@gmail.com>.
Shawn,

Thanks for your suggestions and for your prompt reply.

> The junit jar is responsible for junit itself, NOT the ability to run junit from ant.  In order to run junit > from ant, you also need the ant-junit.jar in the $ANTHOME/lib directory.  This should be part of
> the normal installation of ant so I am not sure why it isn't working for you.

I can confirm that ant-junit.jar is present:

$ pwd
/usr/local/apache-ant-1.8.0/lib
$ ls -l ant-junit.jar
-rw-r--r--  1 stharms  everyone  12736 May  2 11:10 ant-junit.jar

Here are the jar's contents:

jar tf ant-junit.jar |more
META-INF/
META-INF/MANIFEST.MF
org/
org/apache/
org/apache/tools/
org/apache/tools/ant/
org/apache/tools/ant/taskdefs/
org/apache/tools/ant/taskdefs/optional/
org/apache/tools/ant/taskdefs/optional/junit/
org/apache/tools/ant/taskdefs/optional/junit/xsl/
org/apache/tools/ant/taskdefs/optional/junit/xsl/junit-frames.xsl
org/apache/tools/ant/taskdefs/optional/junit/xsl/junit-noframes.xsl

> Since you are new to java, you may not know that you can open up any jar with a zip tool, like Winzip or winrar.  I do this a lot to inspect the contents of the jar.  If you open up ant-junit.jar, you will see that the org.apache.tools.ant.taskdefs.optional.junit.JUnitTask class is inside.

Notably, in my installation that /isn't/ present!  That would explain
the error, the question would be how do I fix my install?  I've been
using ant pretty successfully to do work-based projects.  Should I try
to re-build and re-configure the source?

Steven

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


RE: Trying to get Ant + JUnit working peaceably

Posted by Shawn Castrianni <Sh...@halliburton.com>.
The junit jar is responsible for junit itself, NOT the ability to run junit from ant.  In order to run junit from ant, you also need the ant-junit.jar in the $ANTHOME/lib directory.  This should be part of the normal installation of ant so I am not sure why it isn't working for you.

Since you are new to java, you may not know that you can open up any jar with a zip tool, like Winzip or winrar.  I do this a lot to inspect the contents of the jar.  If you open up ant-junit.jar, you will see that the org.apache.tools.ant.taskdefs.optional.junit.JUnitTask class is inside.

---
Shawn Castrianni

-----Original Message-----
From: Steven Harms [mailto:steven.harms@gmail.com] 
Sent: Saturday, June 05, 2010 5:20 PM
To: user@ant.apache.org
Subject: Trying to get Ant + JUnit working peaceably

Hello,

I'm attempting to learn Java at present and needed to add some
automation around my build and test cycle.  Coming from Ruby, I've got
a real test-first design discipline.

When I attempted to make a <junit> task call, I started getting this
error (I can hear eyes rolling...).


BUILD FAILED
/Users/stharms/java_card/build.xml:38: Problem: failed to create task
or type junit
Cause: the class
org.apache.tools.ant.taskdefs.optional.junit.JUnitTask was not found.
        This looks like one of Ant's optional components.
Action: Check that the appropriate optional JAR exists in
        -/usr/local/apache-ant-1.8.0/lib
        -/Users/stharms/.ant/lib
        -a directory added on the command line with the -lib argument

OK, I'm open to trying to step through the directions.

Most searches and archives suggested that it was paramount to make
sure that the junit library was in $ANTDIR/lib.

In this directory I have both:

junit-3.8.2.jar : retrieved with ant -f fetch.xml -Ddest=system
junit-4.9-SNAPSHOT-20100512-0041.jar : built from github

I then thought, OK let's go with the instructions strictly, what's in
the lib/optional subdir.  Nothing!  OK, so I used the fetch.xml task
to pull the jars into optional.

Re-try, same error.

OK, IRC.  A kind soul there pointed out that on his debian system this
class file was part of optionals.jar that "just worked" as part of
using apt-get ant-optionals.  Hm, regrettably that answer isn't
portable to my platform.

So, I'm stuck.  Can anyone help me get around this low point.  I'm
excited to start programming Java, but I've wound up programming Ant
most of the day -- not a bad thing, just not the shiny app I had
dreamt of :)

Thanks in advance, mysterious guru with the answer,

Steven

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

----------------------------------------------------------------------
This e-mail, including any attached files, may contain confidential and privileged information for the sole use of the intended recipient.  Any review, use, distribution, or disclosure by others is strictly prohibited.  If you are not the intended recipient (or authorized to receive information for the intended recipient), please contact the sender by reply e-mail and delete all copies of this message.

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