This week's book / license giveaways are in the JDBC and Relational Databases and Java in General forums.
We're giving away four copies each of PostGIS in Action and Java Advanced Topics Training and have the authors on-line!
See this thread and this one for details.
The moose likes Ant, Maven and Other Build Tools and the fly likes Juint task in Ant Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "Juint task in Ant" Watch "Juint task in Ant" New topic
Author

Juint task in Ant

Hongli Li
Ranch Hand

Joined: Oct 29, 2006
Posts: 124
Hi, folks,

I spent the whole afternoon trying to figure out why I couldn't run junit with ant, but unfortunately, it didn't work for me.Can somebody help me?

part of my build.xml:



I'm sure the sequence of compiling test and source code is correct, I added the lib, src/classes, and test/classes to test.classpath which is defined in
path datatype. I test my code in Junit from Eclipse, it passed! When I tried to run it with ANT, then I always got this error:

here is the console output:

I also tried to run ant in eclipse, it didn't work in eclipse neither.
When I run "which ant" in my console, it displays /usr/bin/ant.
Anyone has any clue? Any suggestion is high appreciated.
[ January 10, 2008: Message edited by: Hongli Li ]

Do you know why this cup is useful? Because it is empty.
Jan Cumps
Bartender

Joined: Dec 20, 2006
Posts: 2532
    
  10

Did you follow Ant's instructions You must have junit.jar available?

Try running ant with the -verbose option to get more details logged.

Regards, Jan


OCUP UML fundamental and ITIL foundation
youtube channel
Hongli Li
Ranch Hand

Joined: Oct 29, 2006
Posts: 124
thanks for you reply, Jan

yes, I did follow ant's instruction. junit-3.8.2.jar is under $ANT_HOME/lib folder, as you can see from the log, junit-3.8.2.jar is implicitly added to the classpath.

the following is what I got with -verbose mode.

Jan Cumps
Bartender

Joined: Dec 20, 2006
Posts: 2532
    
  10

java.lang.ClassNotFoundException: first ant junit test
'first ant junit test' is not a valid java class name. Your test class has to be a valid java class, say FirstAntJunitTest.

Regards, Jan
Hongli Li
Ranch Hand

Joined: Oct 29, 2006
Posts: 124
thanks a lot Jan,
I overlooked at that line, My bad, I thought the test node inside Junit is just served as meta info, but actually it should be a full qualified class name.

cheers
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Juint task in Ant