This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
The moose likes Ant, Maven and Other Build Tools and the fly likes ANT+ JUnit issues Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "ANT+ JUnit issues" Watch "ANT+ JUnit issues" New topic

ANT+ JUnit issues

Lief Perry

Joined: Feb 14, 2011
Posts: 1
So I'm trying to run some junit tests with Ant. My relative classpaths/test method in my build.xml looks like this:

<path id="classpath.test">
<path refid="classpath.lib"/>
<pathelement location="tests"/>

<target name="test" depends="test_compile,compile" description="run junit test">
<junit printsummary="true">
<classpath refid="classpath.test" />
<formatter type="brief" usefile="false" />
<test name="chart.ChartGeneratorServletTest" />

Both source files (ChartGeneratorServlet and its Test) are compiled to the tests directory. When I run ant -debug, I see that ant recognizes BOTH of these files in the classpath. However, when I try to run the test target, I get a ClassDefNotFoundError for chart.ChartGeneratorServlet... even though I give the junit target the relative classpath.

Anyone see the issue here?
I agree. Here's the link:
subject: ANT+ JUnit issues
It's not a secret anymore!