jira-importer commented on issue #584:
URL: 
https://github.com/apache/maven-javadoc-plugin/issues/584#issuecomment-2957336999

   **[Andy 
Schlaikjer](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=hazen)**
 commented
   
   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:
   
   ```
   /                   # 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
   ```
   
   Within `/pom.xml`:
   
   ```
   <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>
   ```
   
   Within `/childmulti/pom.xml`:
   
   ```
   <project>
     ...
     <url>http://${host.name}/site/${site.name}/childmulti/</url>
     ...
   </project>
   ```
   
   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:
   
   ```
   $ cd /path/to/project/root/
   $ mvn install
   $ mvn site
   ```
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to