[ 
http://jira.codehaus.org/browse/MJAVADOC-286?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=251366#action_251366
 ] 

Andy Schlaikjer commented on MJAVADOC-286:
------------------------------------------

Here's a workaround I've found useful for generating cross-linked javadoc 
reports for all modules in a multi-module project while avoiding infinite 
recursion and/or Java out of heap memory errors:

Environment:

* Java 6
* Maven 3.0.1
* maven-javadoc-plugin:2.7
* maven-site-plugin:3.0-beta-3

Project layout:

{noformat}
/                   # project root
|- pom.xml          # parent pom
|- module1/         #
|  `- pom.xml       # inherits from /pom.xml
`- module2/         #
|  `- pom.xml       # inherits from /pom.xml
`- childmulti/      # child multi-module
   |- pom.xml       # intermediate parent pom, inherits from /pom.xml
   |- module3/      #
   |  `- pom.xml    # inherits from /childmulti/pom.xml
   `- module4/      #
      `- pom.xml    # inherits from /childmulti/pom.xml
{noformat}

Within {{/pom.xml}}:

{noformat}
<project>
  ...
  <url>http://${host.name}/site/${site.name}/</url>
  ...
  <build>
    <pluginManagement>
      <plugins>
        ...
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-javadoc-plugin</artifactId>
          <version>2.7</version>
        </plugin>
        ...
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-site-plugin</artifactId>
          <version>3.0-beta-3</version>
          <configuration>
            <reportPlugins>
              <plugin>
                <artifactId>maven-javadoc-plugin</artifactId>
                <configuration>
                  <detectLinks>false</detectLinks>
                  <detectOfflineLinks>true</detectOfflineLinks>
                </configuration>
                <reports>
                  <report>javadoc</report>
                </reports>
              </plugin>

              <!-- add more report plugins here -->

            </reportPlugins>
          </configuration>
        </plugin>
      </plugins>
    </pluginManagement>
  </build>
  ...
</project>
{noformat}

Within {{/childmulti/pom.xml}}:

{noformat}
<project>
  ...
  <url>http://${host.name}/site/${site.name}/childmulti/</url>
  ...
</project>
{noformat}

Notice that I've configured maven-javadoc-plugin to use the {{javadoc:javadoc}} 
report goal only, not the {{javadoc:aggregator}} report goal. In addition, the 
{{detectOfflineLinks}} parameter has been turned on.

Using this config, if an aggregate site build is executed within the 
multi-module project root, the {{javadoc:javadoc}} report goal is executed 
independently for each module, but (due to behavior of {{detectOfflineLinks}}) 
each set of javadocs properly cross-references other modules' javadocs.

One note: With this setup, the {{javadoc:javadoc}} report goal tries to fetch 
module poms from a repository during execution, instead of accessing the copies 
in your working directory, so all modules must be installed prior to execution 
of the site reactor build:

{noformat}
$ cd /path/to/project/root/
$ mvn install
$ mvn site
{noformat}



> Version 2.7 in Maven Reactor may cause infinite recursion, symptoms similar 
> to MJAVADOC-268
> -------------------------------------------------------------------------------------------
>
>                 Key: MJAVADOC-286
>                 URL: http://jira.codehaus.org/browse/MJAVADOC-286
>             Project: Maven 2.x Javadoc Plugin
>          Issue Type: Bug
>    Affects Versions: 2.6
>         Environment: Apache Maven 2.2.0 (r788681; 2009-06-26 15:04:01+0200)
> Java version: 1.6.0_13
> Java home: /home/mkleint/javatools/jdk1.6.0_13/jre
> Default locale: en_US, platform encoding: UTF-8
> OS name: "linux" version: "2.6.29.6-desktop-2mnb" arch: "i386" Family: "unix"
>            Reporter: Parag Mehta
>            Assignee: Vincent Siveton
>            Priority: Critical
>             Fix For: 2.6.1
>
>         Attachments: MJAVADOC-286.diff
>
>
> The getModulesLinks() method is unacceptably slow under certain conditions:
> 1. project's url is defined
> 2. one or more projects in reactor do not have any java sources and are not 
> of "pom" packaging.
> For such projects the apidocs/ output folder is never created resulting in 
> repeated invokation of a forked javadoc goal. It's more severe with high 
> number of modules in reactor and high number of modules without any java 
> sources.
> as an example checkout "hg clone https://hg.kenai.com/hg/forceten~src";
> The immediate problem is in the apidocsFile.exists() condition that 
> re-triggers the forked invokation. The attached patch fixes that. However it 
> looks suspicitions that the method is being called repeatedly for each module 
> at all. Maybe the aborting condition at the start of the method body is wrong 
> (I was not able to decypher that)
> workaround is to use 2.5 or not to specify the url in pom.xml or set the 
> detectOfflineLinks parameter to "false".

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to