I am having issues integrating junit with a working ant build.xml file. My test class is in the same directory as my source classes. As I am learning how to use ant, I simply want to compile all the source and the test classes.
I am using eclipse and the junit test classes work fine when execute through eclipse. Which means the classpath is set up correctly (at least from eclipse's point of view) with junit.jar and ant-junit-1.7.0.jar, although I am not sure if the latter jar is absolutely necessary.
My folder structure is:
src/code/MyClass.java src/code/MyClassTest.java
and the ant file contain only one target, just to compile MyClass and MyClassTest, I do not include any junit tasks at the moment, and do not mind to have the build files in the same directory as well:
<target name="compile" >
<javac srcdir="src/" />
</target>
Ant worked fine until I added MyClassTest.java (Junit with annotations) in my folder. The output is:
[javac] C:\....\src\MyClassTest.java:3: package org.junit does not exist
cannot find symbol
My thinking is that somehow Ant can't find the junit libraries. Since I do not specify a classpath, I was assuming that Ant would look at the same location as the source files to find to find what it needs...How can I tell Ant that the junit jars are right there?
Any ideas, are really appreciated. Regards