import-bot (20211) [Avatar] Offline
#1
[Originally posted by mikeoc293]

I have been working may way through the book and have run into a problem with
using the junit task. I am using ant version 1.5.3-1 and junit version 3.8.1.
Per the installation instructions, I have copied the junit.jar into the ant
lib directory. However, I am still experiencing the "Could not create task or
type of type: junit" error. The movement of the junit.jar file to the ant lib
directory seems to work for others, but it hasn't worked for me. Any ideas?
import-bot (20211) [Avatar] Offline
#2
Re: ant-junit integration (4)
[Originally posted by mikeoc293]

Steve:

You were right! I did have a version of ant installed with a version of tomcat
which apparently was running ant instead of the version I recently downloaded.
Once I ran ant with its explicit path, it ran perfectly.

Thanks for all your help!

Mike

import-bot (20211) [Avatar] Offline
#3
Re: ant-junit integration
[Originally posted by steve_l]

Having written the error text that comes with the message, I must ask that you
check every possibility

-is optional.jar there?
-Does it contain the junit stuff under
org.apache.tools.ant.taskdefs.optional.junit ?
-try running ant -diagnostics
import-bot (20211) [Avatar] Offline
#4
Re: ant-junit integration (3)
[Originally posted by erikhatcher]

Glad you got the issue resolved. One note, you don't need to use
${env.ANT_HOME} - Ant defines
${ant.home} automatically for you. In fact, you don't even need a system
ANT_HOME to run Ant,
simply placing the bin directory is sufficient enough.
import-bot (20211) [Avatar] Offline
#5
Re: ant-junit integration (2)
[Originally posted by mikeoc293]

Thanks for your help, but I am still unable to locate the problem.

- The optional.jar far is in the ant lib directory.

- The optional jar does contain the org.apach.tools.ant.taskdefs.optonal.junit
classes.

running ant -diagnostics produces the following output

------- Ant diagnostics report -------
Apache Ant version 1.5.3 compiled on April 16 2003

-------------------------------------------
Implementation Version (JDK1.2+ only)
-------------------------------------------
core tasks : 1.5.3
optional tasks : 1.5.3

-------------------------------------------
ANT_HOME/lib jar listing
-------------------------------------------
ant.home: C:javalibapache-ant-1.5.3-1
ant.jar (737884 bytes)
xml-apis.jar (108484 bytes)
xercesImpl.jar (885250 bytes)
junit.jar (121070 bytes)
optional.jar (671546 bytes)

-------------------------------------------
Tasks availability
-------------------------------------------
stlist : Missing dependency com.starbase.starteam.Item
telnet : Missing dependency com.oroinc.net.SocketClient
ftp : Missing dependency com.oroinc.net.ftp.FTP
jdepend : Missing dependency jdepend.xmlui.JDepend
script : Missing dependency com.ibm.bsf.BSFException
junit : Missing dependency junit.framework.TestListener
stcheckin : Missing dependency com.starbase.starteam.Item
stcheckout : Missing dependency com.starbase.starteam.Item

-------------------------------------------
org.apache.env.Which diagnostics
-------------------------------------------
Not available.
Download it at http://xml.apache.org/commons/

the rest are environment sttings
import-bot (20211) [Avatar] Offline
#6
Re: ant-junit integration (2)
[Originally posted by erikhatcher]

Is it possible you have a system CLASSPATH conflict?
import-bot (20211) [Avatar] Offline
#7
Re: ant-junit integration (3)
[Originally posted by mikeoc293]

I am not using or have defined a system classpath. I do, however, declare it
in my compile class path declaration within the build.xml:

<property environment="env"/>
<property name="root.dir" location="${basedir}" />
<property name="build.dir" location="${root.dir}/build" />
<property name="build.classes.dir" location="${build.dir}/classes" />
<property name="dist.dir" location="${root.dir}/dist" />
<property name="junit.dir" location="${env.ANT_HOME}/lib" />

<property name="junit.jar" location="${junit.dir}/junit.jar" />


<path id="compile.classpath">
<pathelement location="${build.classes.dir}" />
<pathelement location="${junit.jar}" />
</path>
import-bot (20211) [Avatar] Offline
#8
Re: ant-junit integration (3)
[Originally posted by steve_l]

dont worry about the build file, if ant -diagnostics is unhappy, the problems
go deep.


1. Ant is not finding the junit classes. as shown by the -diagnostics error

2. therefore, the junit.jar isnt really there
-look inside it. Is it valid? Is the missing class there?

3. you may be running a different version of ant from what you think too
-tomcat or some IDE could have snuck in their own copy.