Author: vsiveton Date: Fri Jun 6 05:49:39 2008 New Revision: 663917 URL: http://svn.apache.org/viewvc?rev=663917&view=rev Log: MJAVADOC-196: Create AggregatorJavadocMojo similar to AggregatorSourceJarMojo
o added two new goals: javadoc:aggregate and javadoc:test-aggregate o updated documentation Added: maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/AggregatorJavadocReport.java (with props) maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/TestAggregatorJavadocReport.java (with props) Modified: maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/AbstractJavadocMojo.java maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/JavadocJar.java maven/plugins/trunk/maven-javadoc-plugin/src/site/apt/examples/aggregate.apt maven/plugins/trunk/maven-javadoc-plugin/src/site/apt/index.apt maven/plugins/trunk/maven-javadoc-plugin/src/site/fml/faq.fml Modified: maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/AbstractJavadocMojo.java URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/AbstractJavadocMojo.java?rev=663917&r1=663916&r2=663917&view=diff ============================================================================== --- maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/AbstractJavadocMojo.java (original) +++ maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/AbstractJavadocMojo.java Fri Jun 6 05:49:39 2008 @@ -303,6 +303,7 @@ /** * Whether to build an aggregated report at the root, or build individual reports. + * Since 2.5, you could use <code>javadoc:aggregate</code> goal as an alternative. * * @parameter expression="${aggregate}" default-value="false" */ @@ -1766,6 +1767,11 @@ { List sourceRoots = getProjectSourceRoots( subProject ); + if ( subProject.getExecutionProject() != null ) + { + sourceRoots.addAll( getExecutionProjectSourceRoots( subProject ) ); + } + ArtifactHandler artifactHandler = subProject.getArtifact().getArtifactHandler(); if ( "java".equals( artifactHandler.getLanguage() ) ) { Added: maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/AggregatorJavadocReport.java URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/AggregatorJavadocReport.java?rev=663917&view=auto ============================================================================== --- maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/AggregatorJavadocReport.java (added) +++ maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/AggregatorJavadocReport.java Fri Jun 6 05:49:39 2008 @@ -0,0 +1,53 @@ +package org.apache.maven.plugin.javadoc; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.util.Locale; + +import org.apache.maven.reporting.MavenReportException; +import org.codehaus.doxia.sink.Sink; + +/** + * Generates documentation for the <code>Java code</code> in an <b>aggregator</b> project using the standard + * <a href="http://java.sun.com/j2se/javadoc/">Javadoc Tool</a>. + * <br/> + * <b>Note</b>: the <code>aggregate</code> parameter is always set to <code>true</code>. + * + * @author <a href="mailto:[EMAIL PROTECTED]">Vincent Siveton</a> + * @version $Id$ + * @goal aggregate + * @aggregator + * @since 2.5 + */ +public class AggregatorJavadocReport + extends JavadocReport +{ + /** + * @see org.apache.maven.plugin.javadoc.JavadocReport#generate(org.codehaus.doxia.sink.Sink, java.util.Locale) + */ + public void generate( Sink sink, Locale locale ) + throws MavenReportException + { + // operate always in aggregation mode + aggregate = true; + + super.generate( sink, locale ); + } +} Propchange: maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/AggregatorJavadocReport.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/AggregatorJavadocReport.java ------------------------------------------------------------------------------ svn:keywords = Author Date Id Revision Modified: maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/JavadocJar.java URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/JavadocJar.java?rev=663917&r1=663916&r2=663917&view=diff ============================================================================== --- maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/JavadocJar.java (original) +++ maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/JavadocJar.java Fri Jun 6 05:49:39 2008 @@ -38,7 +38,9 @@ import java.util.Iterator; /** - * Bundles the javadoc documentation in a jar so it can be deployed to the repo. + * Bundles the Javadoc documentation into a jar. + * <br/> + * <b>Note</b>: the <code>aggregate</code> parameter is always set to <code>false</code>. * * @version $Id$ * @since 2.0 Added: maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/TestAggregatorJavadocReport.java URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/TestAggregatorJavadocReport.java?rev=663917&view=auto ============================================================================== --- maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/TestAggregatorJavadocReport.java (added) +++ maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/TestAggregatorJavadocReport.java Fri Jun 6 05:49:39 2008 @@ -0,0 +1,53 @@ +package org.apache.maven.plugin.javadoc; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.util.Locale; + +import org.apache.maven.reporting.MavenReportException; +import org.codehaus.doxia.sink.Sink; + +/** + * Generates documentation for the <code>Java Test code</code> in an <b>aggregator</b> project using the standard + * <a href="http://java.sun.com/j2se/javadoc/">Javadoc Tool</a>. + * <br/> + * <b>Note</b>: the <code>aggregate</code> parameter is always set to <code>true</code>. + * + * @author <a href="mailto:[EMAIL PROTECTED]">Vincent Siveton</a> + * @version $Id$ + * @goal test-aggregate + * @aggregator + * @since 2.5 + */ +public class TestAggregatorJavadocReport + extends TestJavadocReport +{ + /** + * @see org.apache.maven.plugin.javadoc.JavadocReport#generate(org.codehaus.doxia.sink.Sink, java.util.Locale) + */ + public void generate( Sink sink, Locale locale ) + throws MavenReportException + { + // operate always in aggregation mode + aggregate = true; + + super.generate( sink, locale ); + } +} Propchange: maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/TestAggregatorJavadocReport.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/TestAggregatorJavadocReport.java ------------------------------------------------------------------------------ svn:keywords = Author Date Id Revision Modified: maven/plugins/trunk/maven-javadoc-plugin/src/site/apt/examples/aggregate.apt URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/site/apt/examples/aggregate.apt?rev=663917&r1=663916&r2=663917&view=diff ============================================================================== --- maven/plugins/trunk/maven-javadoc-plugin/src/site/apt/examples/aggregate.apt (original) +++ maven/plugins/trunk/maven-javadoc-plugin/src/site/apt/examples/aggregate.apt Fri Jun 6 05:49:39 2008 @@ -3,7 +3,7 @@ ------ Maria Odea Ching ------ - June 2006 + June 2008 ------ ~~ Licensed to the Apache Software Foundation (ASF) under one @@ -28,9 +28,6 @@ Aggregating Javadocs for Multi-Projects - The \<aggregate\> parameter can be used to generate javadocs for multi-module projects. It gives the option to - generate one javadoc report for the entire project (all modules) or generate one javadoc report for each module. - For example, consider the following directory structure: +-----+ @@ -46,9 +43,14 @@ +-----+ - When you execute javadoc from Project directory with aggregate set to <<true>>, a javadoc report will be created +* Using the \<aggregate\> parameter + + The \<aggregate\> parameter can be used to generate javadocs for multi-module projects. It gives the option to + generate one javadoc report for the entire project (all modules) or generate one javadoc report for each module. + + When you execute javadoc:javadoc from Project directory with aggregate set to <<true>>, a javadoc report will be created in the target directory of Project with all the javadocs of Project's modules included. If aggregate is - set to <<false>>, a javadoc report for Module1 will be generated in the target directory of Module1, a javadoc + set to <<false>> (default), a javadoc report for Module1 will be generated in the target directory of Module1, a javadoc report for Module2 will be generated in the target directory of Module2, and a javadoc report for Module3 will be generated in the target directory of Module3. @@ -72,3 +74,9 @@ ... </project> +-----+ + +* Using the \<aggregate\> goal + + The \<aggregate\> parameter doesn't include generate source directories defined using the + {{{http://mojo.codehaus.org/build-helper-maven-plugin/add-source-mojo.html}build-helper:add-source}}. In this case, you need + to use the <<<aggregate>>> goal and <<<test-aggregate>>> goals. \ No newline at end of file Modified: maven/plugins/trunk/maven-javadoc-plugin/src/site/apt/index.apt URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/site/apt/index.apt?rev=663917&r1=663916&r2=663917&view=diff ============================================================================== --- maven/plugins/trunk/maven-javadoc-plugin/src/site/apt/index.apt (original) +++ maven/plugins/trunk/maven-javadoc-plugin/src/site/apt/index.apt Fri Jun 6 05:49:39 2008 @@ -4,7 +4,7 @@ Maria Odea Ching Vincent Siveton ------ - May 2007 + June 2008 ------ ~~ Licensed to the Apache Software Foundation (ASF) under one @@ -49,16 +49,22 @@ * Goals Overview - The Javadoc Plugin has three goals: + The Javadoc Plugin has five goals: - * {{{javadoc-mojo.html}javadoc:javadoc}} generates the javadoc files for the project. It executes the standard + * {{{javadoc-mojo.html}javadoc:javadoc}} generates the Javadoc files for the project. It executes the standard Javadoc tool and supports the parameters used by the tool. - * {{{test-javadoc-mojo.html}javadoc:test-javadoc}} generates the test javadoc files for the project. It executes the standard + * {{{test-javadoc-mojo.html}javadoc:test-javadoc}} generates the test Javadoc files for the project. It executes the standard Javadoc tool and supports the parameters used by the tool. - * {{{jar-mojo.html}javadoc:jar}} creates an archive file of the generated javadocs. It is used during - the release process to create the javadoc artifact for the project's release. This artifact is uploaded + * {{{aggregate-mojo.html}javadoc:aggregate}} generates the Javadoc files for an aggregator project. It executes the standard + Javadoc tool and supports the parameters used by the tool. + + * {{{test-aggregate-mojo.html}javadoc:test-aggregate}} generates the test Javadoc files for an aggregator project. It executes the standard + Javadoc tool and supports the parameters used by the tool. + + * {{{jar-mojo.html}javadoc:jar}} creates an archive file of the generated Javadocs. It is used during + the release process to create the Javadoc artifact for the project's release. This artifact is uploaded to the remote repository along with the project's compiled binary and source archive. * Usage @@ -90,3 +96,5 @@ * {{{examples/test-javadocs.html}Generating test Javadocs}} * {{{examples/selective-javadocs-report.html}Selective Javadocs Reports}} + + [] Modified: maven/plugins/trunk/maven-javadoc-plugin/src/site/fml/faq.fml URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/site/fml/faq.fml?rev=663917&r1=663916&r2=663917&view=diff ============================================================================== --- maven/plugins/trunk/maven-javadoc-plugin/src/site/fml/faq.fml (original) +++ maven/plugins/trunk/maven-javadoc-plugin/src/site/fml/faq.fml Fri Jun 6 05:49:39 2008 @@ -214,5 +214,17 @@ </p> </answer> </faq> + <faq id="How to include additional source code directories in aggregate mode"> + <question>How to include additional source code directories in aggregate mode?</question> + <answer> + <p> + If you use the Javadoc report in the aggregate mode, i.e. using the <code>aggregate</code> parameter, and if the + Javadoc report does not include additional source code directories defined using the + <a href="http://mojo.codehaus.org/build-helper-maven-plugin/add-source-mojo.html">build-helper:add-source</a> goal, + you need to use the <code>javadoc:aggregate</code> goal instead of <code>javadoc:javadoc</code> goal. Read the + <a href="examples/aggregate.html">Aggregating Javadocs for Multi-Projects</a> part for more information. + </p> + </answer> + </faq> </part> </faqs> \ No newline at end of file