I am trying to create aggregate javadoc for a project with several modules. The project is compiled using mvn install -DskipTests (I do not run tests on my machine). When I run mvn validate javadoc:javadoc , it works and compiles all javadoc in each modules \ target \ apidocs directory. Then, when I run either mvn validate javadoc:javadoc javadoc:aggregate or mvn validate javadoc:aggregate , incomplete execution occurs with approximately 1,200 lines of errors. Some examples of types:
Failed to execute goal org.apache.maven.plugins:maven-javadoc-plugin:2.9.1:aggregate (default-cli) on project commons-superpom: An error has occurred in JavaDocs report generation: [ERROR] Exit code: 1 - C:\workspaces\win\tfs\****\Foo.java:21: type org.springframework.context.ApplicationListener does not take parameters [ERROR] public class Foo implements ApplicationContextAware, ApplicationListener<ContextRefreshedEvent> { [ERROR] ^ . . . C:\workspaces\win\tfs\****\test\Bar.java:52: cannot find symbol [ERROR] symbol : class PostInsertEvent [ERROR] location: class com.Barclass [ERROR] public void BarFunct(PostInsertEvent event) { [ERROR] ^ [ERROR] C:java.lang.NullPointerException [ERROR] at com.sun.tools.javadoc.TypeMaker.getType(TypeMaker.java:67) [ERROR] at com.sun.tools.javadoc.TypeMaker.getType(TypeMaker.java:29) [ERROR] at com.sun.tools.javadoc.ClassDocImpl.superclassType(ClassDocImpl.java:439) [ERROR] at com.sun.tools.doclets.internal.toolkit.util.Util.getAllInterfaces(Util.java:386) [ERROR] at com.sun.tools.doclets.internal.toolkit.util.Util.getAllInterfaces(Util.java:424) [ERROR] at com.sun.tools.doclets.internal.toolkit.util.ClassTree.processType(ClassTree.java:162) [ERROR] at com.sun.tools.doclets.internal.toolkit.util.ClassTree.buildTree(ClassTree.java:114) [ERROR] at com.sun.tools.doclets.internal.toolkit.util.ClassTree.<init>(ClassTree.java:73) [ERROR] at com.sun.tools.doclets.internal.toolkit.AbstractDoclet.startGeneration(AbstractDoclet.java:104) [ERROR] at com.sun.tools.doclets.internal.toolkit.AbstractDoclet.start(AbstractDoclet.java:64) [ERROR] at com.sun.tools.doclets.formats.html.HtmlDoclet.start(HtmlDoclet.java:42) [ERROR] at com.sun.tools.doclets.standard.Standard.start(Standard.java:23) [ERROR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [ERROR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [ERROR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [ERROR] at java.lang.reflect.Method.invoke(Method.java:597) [ERROR] at com.sun.tools.javadoc.DocletInvoker.invoke(DocletInvoker.java:269) [ERROR] at com.sun.tools.javadoc.DocletInvoker.start(DocletInvoker.java:143) [ERROR] at com.sun.tools.javadoc.Start.parseAndExecute(Start.java:340) [ERROR] at com.sun.tools.javadoc.Start.begin(Start.java:128) [ERROR] at com.sun.tools.javadoc.Main.execute(Main.java:41) [ERROR] at com.sun.tools.javadoc.Main.main(Main.java:31)
After it dumps everything that remains in the / target directory next to my parent, pom.xml is 2 files. 1 is javadoc-bundle-options which contains the xml file:
<?xml version="1.0" encoding="UTF-8"?> <javadocOptions> <docletArtifacts> <docletArtifact /> </docletArtifacts> <tagletArtifacts> <tagletArtifact /> </tagletArtifacts> <excludePackageNames> <excludePackageName>org.foobar.*</excludePackageName> </excludePackageNames> <javadocResourcesDirectory>src/main/javadoc</javadocResourcesDirectory> </javadocOptions>
and the second is the site containing the apidocs file, which contains 3 javadoc.bat files, options and packages. They contain what they contain in the script package to run javadoc.exe with these parameters and in these packages.
The first error I copied is incorrect. ApplicationListener is parameterized and can accept ContextRefreshedEvent in the spring documentation. PostInsertEvent is also correctly imported into the second error. I do not know where a NullPointerException occurs.
My plugin configuration for javadoc: aggregate is as follows:
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-javadoc-plugin</artifactId> <version>${maven-javadoc-plugin.version}</version> <executions> <execution> <id>attach-javadocs</id> <goals> <goal>aggregate</goal> </goals> </execution> </executions> <configuration> <excludePackageNames>org.hibernate.*;org.spring.*<-!-- ;com.***.hibernate.audit --></excludePackageNames> <verbose>true</verbose> <fork>true</fork> <showDeprecation>true</showDeprecation> <showWarnings>true</showWarnings> <source>${java.source.version}</source> <target>${java.target.version}</target> <compilerVersion>${java.source.version}</compilerVersion> <compilerArgument>-Xlint:all</compilerArgument> <minmemory>128m</minmemory> <maxmem>512m</maxmem> <encoding>${project.build.sourceEncoding}</encoding> <additionalparam> -charset UTF-8 -docencoding UTF-8 -version -author -breakiterator -linksource -sourcetab 4 -windowtitle "${project.name} ${project.version} API Reference" -doctitle "${project.name} ${project.version} API Reference" -bottom "Copyright ${project.inceptionYear}-Present ${project.organization.name}. All Rights Reserved." -link http://java.sun.com/javase/6/docs/api/ -link http://jsr311.java.net/nonav/releases/1.1 </additionalparam> </configuration> </plugin>
If I exclude the commented package, the assembly works fine. If, however, I exclude all the files in the package, and not the package, then it crashes with very similar errors. I can generate javadoc just fine in eclipse. I can stop the nullpointer exception by editing the options file created after the failure to use 3.3.2.GA/hibernate-core-3.3.2.GA.jar instead of hibernate-core-4.1.8.Final.jar and then run the bat file . This creates a complete javadoc aggregate site, however there are a few @Typedef-related errors in startup. Javadoc 1.7_60 and 1.6_45 both do not work the same.