问题
I am attempting to compile JavaDocs with:
mvn javadoc:aggregate
I keep getting errors such as:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-javadoc-plugin:2.5:aggregate (default-cli) on project mutopia: An error has occurred in JavaDocs report generation:Exit code: 1 - /Users/Aram/Development/Java/MUtopia/Code/mutopia/mutopia-server/src/main/java/au/edu/unimelb/civenv/hpvat/mutopia/server/Asset.java:3: package org.springframework.roo.addon.javabean does not exist
[ERROR] import org.springframework.roo.addon.javabean.RooJavaBean;
and
[ERROR] /Users/Aram/Development/Java/MUtopia/Code/mutopia/mutopia-server/src/main/java/au/edu/unimelb/civenv/hpvat/mutopia/server/Param.java:8: package flexjson does not exist
[ERROR] import flexjson.JSONDeserializer;
Clearly my dependencies for a multi-module/aggregation project are not being recognised. Both these are marked as dependencies in one of my modules' pom.xml
file. Do I need to provide additional arguments to maven-javadoc-plugin
in the parent pom.xml?
EDIT:
I ran mvn install
and it seemed to work. My parent pom.xml
is:
<build>
...
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.5</version>
<configuration>
<aggregate>true</aggregate>
</configuration>
</plugin>
...
</build>
The version is outdated but that didn't seem to be the problem.
回答1:
You need to go via the pom configuration like this:
<project>
...
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.9</version>
<configuration>
<!-- Default configuration for all reports -->
...
</configuration>
<executions>
<execution>
<id>aggregate</id>
<goals>
<goal>aggregate</goal>
</goals>
<phase>site</phase>
<configuration>
<!-- Specific configuration for the aggregate report -->
...
</configuration>
</execution>
...
</executions>
</plugin>
...
</plugins>
</build>
...
</project>
and than you need to call mvn site ...
来源:https://stackoverflow.com/questions/14122648/maven-javadoc-plugin-aggregate-dependencies