Search code examples
javaclasspathjavadocplayframework

Javadoc: Annotations from third party libraries


I'm trying to write an SVN Post-Commit hook to generate javadoc on a webpage whenever someone submits any changes to relevant files.

I was new to the hook concept, but I didn't expect to run in any strange errors when generating the javadoc.

java.lang.ClassCastException: com.sun.tools.javadoc.ClassDocImpl cannot be cast to com.sun.javadoc.AnnotationTypeDoc
    at com.sun.tools.javadoc.AnnotationDescImpl.annotationType(AnnotationDescImpl.java:46)
    at com.sun.tools.doclets.internal.toolkit.util.Util.isDeprecated(Util.java:811)
    at com.sun.tools.doclets.formats.html.AbstractIndexWriter.printComment(AbstractIndexWriter.java:186)

After a few succesful searches on StackOverFlow I discovered it had something to do with third-party-annotations. (I make use of the Play framework and that uses a number of other libraries)

So I included everything in a script:

#!/bin/sh

CLASSPATH="~/Play/play-1.1.1/;"

javadoc -d ~/svndoc/ -classpath $CLASSPATH -sourcepath ~/svntest/avon/trunk/ScoreDB/app @packages

But this generates the exact same errors. Sometimes there are 10 warnings, but most of the time there are 27 of them.

Could you guys help me out?

Thanks in advance, Jasper


Solution

  • Your classpath looks wrong. First, there should be no ; in it (in Unix, the separator is :, but it is not needed at the end). Secondly, do you really have the individual class files in this directory? If there are jar files, you need to either list them individually, or put a * there (but pay attention that bash does not expand it, since you would need : instead of spaces between).

    I have no idea if this would solve the problem, though.