When I run javadoc on my java source code, I get this error for th Junit test class:
[javadoc] /mypath/TestStuff.class: warning: Cannot find annotation method 'expected()' in type 'org.junit.Test': class file for org.junit.Test not found
The problem appears with junit version 4 with this type of annotation:
@Test(expected=Exception.class)
Obvisouly, it sounds like javadoc cannot find org.junit.Test but why would it need it in the 1st place ? How do I fix that ?
Cheers
David
UPDATE:
the junit jar is not on my project classpath but is in $ANT_HOME/lib. This way, I don’t have to add it to my project lib folder and the junit ant target works fine.
It sounds like the javadoc target in ant doesn’t use the $ANT_HOME/lib to look for jars
org.junit.Test is the class defining the @Test annotation that you’re using. Sounds like you need to add the junit jar to the classpath.
EDIT: I set up projects with ant to use 2 classpaths, one for regular classes and one for test-only stuff, and I add junit to the test-only classpath.