Maven Javadoc报告:聚合和检测链接

时间:2014-03-28 00:20:33

标签: java maven maven-site-plugin maven-javadoc-plugin

在Maven Site构建中,我想生成一个聚合的Javadoc报告,其中包含指向其他Javadoc的链接(detectLinks = true)。

在我在报告部分中定义的一个父POM中:

<reporting>
    <plugins>
        ...
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <version>2.9</version> 
            <reportSets>
                <reportSet>
                    <id>default</id>
                    <configuration>
                        <detectOfflineLinks>true</detectOfflineLinks>
                    </configuration>
                    <reports>
                        <report>javadoc</report>
                    </reports>
                </reportSet>
                <reportSet>
                    <id>aggregate</id>
                    <reports>
                        <report>aggregate</report>
                    </reports>
                </reportSet>
            </reportSets>
            <configuration>
                <detectLinks>true</detectLinks>
            </configuration>
        </plugin>
    </plugins>
</reporting>

多模块聚合器项目的有效POM报告部分是:

  <reporting>
    <outputDirectory>someDir</outputDirectory>
    <plugins>
      ...
      <plugin>
        <artifactId>maven-javadoc-plugin</artifactId>
        <version>2.9</version>
        <reportSets>
          <reportSet>
            <reports>
              <report>javadoc</report>
            </reports>
            <configuration>
              <detectOfflineLinks>true</detectOfflineLinks>
              <detectLinks>true</detectLinks>
            </configuration>
          </reportSet>
          <reportSet>
            <id>aggregate</id>
            <reports>
              <report>aggregate</report>
            </reports>
            <configuration>
              <detectLinks>true</detectLinks>
            </configuration>
          </reportSet>
        </reportSets>
        <configuration>
          <detectLinks>true</detectLinks>
        </configuration>
      </plugin>
    </plugins>
  </reporting>

尽管如此,只有单个Javadoc报告才会考虑detectLinks,但对于聚合的Javadoc报告则不会。

如何为聚合的Javadoc报告启用detectLink?

1 个答案:

答案 0 :(得分:1)

问题是聚合目标只检查根项目的依赖关系,而不检查模块。刚刚创建了补丁问题:http://jira.codehaus.org/browse/MJAVADOC-390

临时解决方案可以是在根项目上声明你的依赖...但它很丑陋

- Vazul