I'm having problems integrating junit with the ant build.xml working file. My test class is in the same directory as my source classes. Since I am learning how to use ant, I just want to compile all the source and test classes.
I use eclipse and the junit test classes work fine when executed through eclipse. This means that the class path is configured correctly (at least in terms of eclipse) using junit.jar and ant -junit-1.7.0.jar, although I'm not sure that the last jar is absolutely necessary.
My folder structure:
Src / code / MyClass.java src / code / MyClassTest.java
and the ant file contains only one goal, just to compile MyClass and MyClassTest, at the moment I do not include junit tasks and do not want to have assembly files in the same directory:
<target name="compile" >
<javac srcdir="src/" />
</target>
Ant worked fine until I added MyClassTest.java (Junit with annotations) to my folder. Exit:
[javac] C:\....\src\MyClassTest.java:3: package org.junit does not exist
cannot find symbol
My thinking is that somehow ant cannot find junit libraries. Since I do not specify the class path, I assumed that ant would search the same place as the source files to find what it needed ... How can I tell ant that junit jars is right there?
Any ideas really appreciated. Relations
source
share