Added: 
maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugins/javadoc/AdditionalDependency.java
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugins/javadoc/AdditionalDependency.java?rev=1801772&view=auto
==============================================================================
--- 
maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugins/javadoc/AdditionalDependency.java
 (added)
+++ 
maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugins/javadoc/AdditionalDependency.java
 Wed Jul 12 19:59:51 2017
@@ -0,0 +1,32 @@
+package org.apache.maven.plugins.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 org.apache.maven.model.Dependency;
+
+/**
+ * Provides syntactic sugar for using the standard {@code Dependency}
+ * model as a parameter to {@link AbstractJavadocMojo}'s {@code 
additionalDependencies}.
+ */
+public class AdditionalDependency
+    extends Dependency
+{
+    // no op
+}

Added: 
maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugins/javadoc/AggregatorJavadocJar.java
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugins/javadoc/AggregatorJavadocJar.java?rev=1801772&view=auto
==============================================================================
--- 
maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugins/javadoc/AggregatorJavadocJar.java
 (added)
+++ 
maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugins/javadoc/AggregatorJavadocJar.java
 Wed Jul 12 19:59:51 2017
@@ -0,0 +1,45 @@
+package org.apache.maven.plugins.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 org.apache.maven.plugins.annotations.Execute;
+import org.apache.maven.plugins.annotations.LifecyclePhase;
+import org.apache.maven.plugins.annotations.Mojo;
+import org.apache.maven.plugins.annotations.ResolutionScope;
+
+/**
+ * Bundles the Javadoc documentation for main <code>Java code</code> in an 
<b>aggregator</b> project into a jar
+ * using the standard <a 
href="http://docs.oracle.com/javase/7/docs/technotes/guides/javadoc/";>Javadoc 
Tool</a>.
+ *
+ * @version $Id: AggregatorJavadocJar.java 1749408 2016-06-20 22:54:15Z 
schulte $
+ * @since 2.6
+ */
+@Mojo( name = "aggregate-jar", defaultPhase = LifecyclePhase.PACKAGE, 
aggregator = true,
+       requiresDependencyResolution = ResolutionScope.COMPILE )
+@Execute( phase = LifecyclePhase.COMPILE )
+public class AggregatorJavadocJar
+    extends JavadocJar
+{
+    @Override
+    protected boolean isAggregator()
+    {
+        return true;
+    }
+}

Added: 
maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugins/javadoc/AggregatorJavadocReport.java
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugins/javadoc/AggregatorJavadocReport.java?rev=1801772&view=auto
==============================================================================
--- 
maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugins/javadoc/AggregatorJavadocReport.java
 (added)
+++ 
maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugins/javadoc/AggregatorJavadocReport.java
 Wed Jul 12 19:59:51 2017
@@ -0,0 +1,45 @@
+package org.apache.maven.plugins.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 org.apache.maven.plugins.annotations.Execute;
+import org.apache.maven.plugins.annotations.LifecyclePhase;
+import org.apache.maven.plugins.annotations.Mojo;
+import org.apache.maven.plugins.annotations.ResolutionScope;
+
+/**
+ * Generates documentation for the <code>Java code</code> in an 
<b>aggregator</b> project using the standard
+ * <a 
href="http://docs.oracle.com/javase/7/docs/technotes/guides/javadoc/";>Javadoc 
Tool</a>.
+ *
+ * @author <a href="mailto:vincent.sive...@gmail.com";>Vincent Siveton</a>
+ * @version $Id: AggregatorJavadocReport.java 1749408 2016-06-20 22:54:15Z 
schulte $
+ * @since 2.5
+ */
+@Mojo( name = "aggregate", aggregator = true, requiresDependencyResolution = 
ResolutionScope.COMPILE )
+@Execute( phase = LifecyclePhase.COMPILE )
+public class AggregatorJavadocReport
+    extends JavadocReport
+{
+    @Override
+    protected boolean isAggregator()
+    {
+        return true;
+    }
+}

Added: 
maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugins/javadoc/AggregatorTestJavadocJar.java
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugins/javadoc/AggregatorTestJavadocJar.java?rev=1801772&view=auto
==============================================================================
--- 
maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugins/javadoc/AggregatorTestJavadocJar.java
 (added)
+++ 
maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugins/javadoc/AggregatorTestJavadocJar.java
 Wed Jul 12 19:59:51 2017
@@ -0,0 +1,45 @@
+package org.apache.maven.plugins.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 org.apache.maven.plugins.annotations.Execute;
+import org.apache.maven.plugins.annotations.LifecyclePhase;
+import org.apache.maven.plugins.annotations.Mojo;
+import org.apache.maven.plugins.annotations.ResolutionScope;
+
+/**
+ * Bundles the Javadoc documentation for <code>Java Test code</code> in an 
<b>aggregator</b> project into a jar
+ * using the standard <a 
href="http://docs.oracle.com/javase/7/docs/technotes/guides/javadoc/";>Javadoc 
Tool</a>.
+ *
+ * @version $Id: AggregatorTestJavadocJar.java 1749408 2016-06-20 22:54:15Z 
schulte $
+ * @since 2.6
+ */
+@Mojo( name = "test-aggregate-jar", defaultPhase = LifecyclePhase.PACKAGE, 
aggregator = true,
+       requiresDependencyResolution = ResolutionScope.TEST )
+@Execute( phase = LifecyclePhase.TEST_COMPILE )
+public class AggregatorTestJavadocJar
+    extends TestJavadocJar
+{
+    @Override
+    protected boolean isAggregator()
+    {
+        return true;
+    }
+}

Added: 
maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugins/javadoc/AggregatorTestJavadocReport.java
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugins/javadoc/AggregatorTestJavadocReport.java?rev=1801772&view=auto
==============================================================================
--- 
maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugins/javadoc/AggregatorTestJavadocReport.java
 (added)
+++ 
maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugins/javadoc/AggregatorTestJavadocReport.java
 Wed Jul 12 19:59:51 2017
@@ -0,0 +1,45 @@
+package org.apache.maven.plugins.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 org.apache.maven.plugins.annotations.Execute;
+import org.apache.maven.plugins.annotations.LifecyclePhase;
+import org.apache.maven.plugins.annotations.Mojo;
+import org.apache.maven.plugins.annotations.ResolutionScope;
+
+/**
+ * Generates documentation for the <code>Java Test code</code> in an 
<b>aggregator</b> project using the standard
+ * <a 
href="http://docs.oracle.com/javase/7/docs/technotes/guides/javadoc/";>Javadoc 
Tool</a>.
+ *
+ * @author <a href="mailto:vincent.sive...@gmail.com";>Vincent Siveton</a>
+ * @version $Id: AggregatorTestJavadocReport.java 1749408 2016-06-20 22:54:15Z 
schulte $
+ * @since 2.5
+ */
+@Mojo( name = "test-aggregate", aggregator = true, 
requiresDependencyResolution = ResolutionScope.TEST )
+@Execute( phase = LifecyclePhase.TEST_COMPILE )
+public class AggregatorTestJavadocReport
+    extends TestJavadocReport
+{
+    @Override
+    protected boolean isAggregator()
+    {
+        return true;
+    }
+}

Added: 
maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugins/javadoc/FixJavadocMojo.java
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugins/javadoc/FixJavadocMojo.java?rev=1801772&view=auto
==============================================================================
--- 
maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugins/javadoc/FixJavadocMojo.java
 (added)
+++ 
maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugins/javadoc/FixJavadocMojo.java
 Wed Jul 12 19:59:51 2017
@@ -0,0 +1,42 @@
+package org.apache.maven.plugins.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 org.apache.maven.plugins.annotations.Execute;
+import org.apache.maven.plugins.annotations.LifecyclePhase;
+import org.apache.maven.plugins.annotations.Mojo;
+import org.apache.maven.plugins.annotations.ResolutionScope;
+
+/**
+ * Fix Javadoc documentation and tags for the <code>Java code</code> for the 
project.
+ * See <a 
href="http://docs.oracle.com/javase/7/docs/technotes/tools/windows/javadoc.html#wheretags";>Where
 Tags Can
+ * Be Used</a>.
+ *
+ * @author <a href="mailto:vincent.sive...@gmail.com";>Vincent Siveton</a>
+ * @version $Id: FixJavadocMojo.java 1642248 2014-11-28 00:10:50Z hboutemy $
+ * @since 2.6
+ */
+@Mojo( name = "fix", requiresDependencyResolution = ResolutionScope.COMPILE, 
threadSafe = true )
+@Execute( phase = LifecyclePhase.COMPILE )
+public class FixJavadocMojo
+    extends AbstractFixJavadocMojo
+{
+    // nop
+}

Added: 
maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugins/javadoc/JavadocArchiveConfiguration.java
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugins/javadoc/JavadocArchiveConfiguration.java?rev=1801772&view=auto
==============================================================================
--- 
maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugins/javadoc/JavadocArchiveConfiguration.java
 (added)
+++ 
maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugins/javadoc/JavadocArchiveConfiguration.java
 Wed Jul 12 19:59:51 2017
@@ -0,0 +1,36 @@
+package org.apache.maven.plugins.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 org.apache.maven.archiver.MavenArchiveConfiguration;
+
+/**
+ * For backwards compatibility, a custom archive configuration that defaults 
to not including the Maven descriptor.
+ *
+ * @see <a 
href="https://issues.apache.org/browse/MJAVADOC-431";>MJAVADOC-431</a>
+ */
+public class JavadocArchiveConfiguration
+    extends MavenArchiveConfiguration
+{
+    public JavadocArchiveConfiguration()
+    {
+        setAddMavenDescriptor( false );
+    }
+}

Added: 
maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugins/javadoc/JavadocJar.java
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugins/javadoc/JavadocJar.java?rev=1801772&view=auto
==============================================================================
--- 
maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugins/javadoc/JavadocJar.java
 (added)
+++ 
maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugins/javadoc/JavadocJar.java
 Wed Jul 12 19:59:51 2017
@@ -0,0 +1,311 @@
+package org.apache.maven.plugins.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 org.apache.maven.archiver.MavenArchiveConfiguration;
+import org.apache.maven.archiver.MavenArchiver;
+import org.apache.maven.artifact.DependencyResolutionRequiredException;
+import org.apache.maven.artifact.handler.ArtifactHandler;
+import org.apache.maven.model.Resource;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugins.annotations.Component;
+import org.apache.maven.plugins.annotations.LifecyclePhase;
+import org.apache.maven.plugins.annotations.Mojo;
+import org.apache.maven.plugins.annotations.Parameter;
+import org.apache.maven.plugins.annotations.ResolutionScope;
+import org.apache.maven.project.MavenProjectHelper;
+import org.apache.maven.reporting.MavenReportException;
+import org.codehaus.plexus.archiver.Archiver;
+import org.codehaus.plexus.archiver.ArchiverException;
+import org.codehaus.plexus.archiver.jar.JarArchiver;
+import org.codehaus.plexus.archiver.jar.ManifestException;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.List;
+import java.util.Locale;
+
+/**
+ * Bundles the Javadoc documentation for <code>main Java code</code> in an 
<b>NON aggregator</b> project into
+ * a jar using the standard <a 
href="http://docs.oracle.com/javase/7/docs/technotes/guides/javadoc/";>Javadoc 
Tool</a>.
+ *
+ * @version $Id: JavadocJar.java 1752018 2016-07-09 16:35:25Z rfscholte $
+ * @since 2.0
+ */
+@Mojo( name = "jar", defaultPhase = LifecyclePhase.PACKAGE, 
requiresDependencyResolution = ResolutionScope.COMPILE,
+                threadSafe = true )
+public class JavadocJar
+    extends AbstractJavadocMojo
+{
+    /**
+     * Includes all generated Javadoc files
+     */
+    private static final String[] DEFAULT_INCLUDES = new String[]{ "**/**" };
+
+    /**
+     * Excludes all processing files.
+     *
+     * @see AbstractJavadocMojo#DEBUG_JAVADOC_SCRIPT_NAME
+     * @see AbstractJavadocMojo#OPTIONS_FILE_NAME
+     * @see AbstractJavadocMojo#PACKAGES_FILE_NAME
+     * @see AbstractJavadocMojo#ARGFILE_FILE_NAME
+     * @see AbstractJavadocMojo#FILES_FILE_NAME
+     */
+    private static final String[] DEFAULT_EXCLUDES =
+        new String[]{ DEBUG_JAVADOC_SCRIPT_NAME, OPTIONS_FILE_NAME, 
PACKAGES_FILE_NAME, ARGFILE_FILE_NAME,
+            FILES_FILE_NAME };
+
+    // ----------------------------------------------------------------------
+    // Mojo components
+    // ----------------------------------------------------------------------
+
+    /**
+     * Used for attaching the artifact in the project.
+     */
+    @Component
+    private MavenProjectHelper projectHelper;
+
+    /**
+     * The Jar archiver.
+     *
+     * @since 2.5
+     */
+    @Component( role = Archiver.class, hint = "jar" )
+    private JarArchiver jarArchiver;
+
+    // ----------------------------------------------------------------------
+    // Mojo Parameters
+    // ----------------------------------------------------------------------
+
+    /**
+     * Specifies the destination directory where javadoc saves the generated 
HTML files.
+     * See <a 
href="http://docs.oracle.com/javase/7/docs/technotes/tools/windows/javadoc.html#d";>d</a>.
+     *
+     * @deprecated
+     */
+    @Parameter( property = "destDir" )
+    private File destDir;
+
+    /**
+     * Specifies the directory where the generated jar file will be put.
+     */
+    @Parameter( property = "project.build.directory" )
+    private String jarOutputDirectory;
+
+    /**
+     * Specifies the filename that will be used for the generated jar file. 
Please note that <code>-javadoc</code>
+     * or <code>-test-javadoc</code> will be appended to the file name.
+     */
+    @Parameter( property = "project.build.finalName" )
+    private String finalName;
+
+    /**
+     * Specifies whether to attach the generated artifact to the project 
helper.
+     * <br/>
+     */
+    @Parameter( property = "attach", defaultValue = "true" )
+    private boolean attach;
+
+    /**
+     * The archive configuration to use.
+     * See <a 
href="http://maven.apache.org/shared/maven-archiver/index.html";>Maven Archiver 
Reference</a>.
+     *
+     * @since 2.5
+     */
+    @Parameter
+    private MavenArchiveConfiguration archive = new 
JavadocArchiveConfiguration();
+
+    /**
+     * Path to the default MANIFEST file to use. It will be used if
+     * <code>useDefaultManifestFile</code> is set to <code>true</code>.
+     *
+     * @since 2.5
+     */
+    @Parameter( defaultValue = 
"${project.build.outputDirectory}/META-INF/MANIFEST.MF", required = true,
+                readonly = true )
+    private File defaultManifestFile;
+
+    /**
+     * Set this to <code>true</code> to enable the use of the 
<code>defaultManifestFile</code>.
+     * <br/>
+     *
+     * @since 2.5
+     */
+    @Parameter( defaultValue = "false" )
+    private boolean useDefaultManifestFile;
+
+    /**
+     * @since 2.10
+     */
+    @Parameter( property = "maven.javadoc.classifier", defaultValue = 
"javadoc", required = true )
+    private String classifier;
+
+    /** {@inheritDoc} */
+    public void doExecute()
+        throws MojoExecutionException
+    {
+        if ( skip )
+        {
+            getLog().info( "Skipping javadoc generation" );
+            return;
+        }
+
+        File innerDestDir = this.destDir;
+        if ( innerDestDir == null )
+        {
+            innerDestDir = new File( getOutputDirectory() );
+        }
+
+        if ( !( "pom".equalsIgnoreCase( project.getPackaging() ) && 
isAggregator() ) )
+        {
+            ArtifactHandler artifactHandler = 
project.getArtifact().getArtifactHandler();
+            if ( !"java".equals( artifactHandler.getLanguage() ) )
+            {
+                getLog().info( "Not executing Javadoc as the project is not a 
Java classpath-capable package" );
+                return;
+            }
+        }
+
+        try
+        {
+            executeReport( Locale.getDefault() );
+        }
+        catch ( MavenReportException e )
+        {
+            failOnError( "MavenReportException: Error while generating 
Javadoc", e );
+        }
+        catch ( RuntimeException e )
+        {
+            failOnError( "RuntimeException: Error while generating Javadoc", e 
);
+        }
+
+        if ( innerDestDir.exists() )
+        {
+            try
+            {
+                File outputFile = generateArchive( innerDestDir, finalName + 
"-" + getClassifier() + ".jar" );
+
+                if ( !attach )
+                {
+                    getLog().info( "NOT adding javadoc to attached artifacts 
list." );
+                }
+                else
+                {
+                    // TODO: these introduced dependencies on the project are 
going to become problematic - can we export it
+                    //  through metadata instead?
+                    projectHelper.attachArtifact( project, "javadoc", 
getClassifier(), outputFile );
+                }
+            }
+            catch ( ArchiverException e )
+            {
+                failOnError( "ArchiverException: Error while creating 
archive", e );
+            }
+            catch ( IOException e )
+            {
+                failOnError( "IOException: Error while creating archive", e );
+            }
+            catch ( RuntimeException e )
+            {
+                failOnError( "RuntimeException: Error while creating archive", 
e );
+            }
+        }
+    }
+
+    // ----------------------------------------------------------------------
+    // Protected methods
+    // ----------------------------------------------------------------------
+
+    /**
+     * @return the wanted classifier, i.e. <code>javadoc</code> or 
<code>test-javadoc</code>
+     */
+    protected String getClassifier()
+    {
+        return classifier;
+    }
+
+    // ----------------------------------------------------------------------
+    // private methods
+    // ----------------------------------------------------------------------
+
+    /**
+     * Method that creates the jar file
+     *
+     * @param javadocFiles the directory where the generated jar file will be 
put
+     * @param jarFileName the filename of the generated jar file
+     * @return a File object that contains the generated jar file
+     * @throws ArchiverException {@link ArchiverException}
+     * @throws IOException {@link IOException}
+     */
+    private File generateArchive( File javadocFiles, String jarFileName )
+        throws ArchiverException, IOException
+    {
+        File javadocJar = new File( jarOutputDirectory, jarFileName );
+
+        if ( javadocJar.exists() )
+        {
+            javadocJar.delete();
+        }
+
+        MavenArchiver archiver = new MavenArchiver();
+        archiver.setArchiver( jarArchiver );
+        archiver.setOutputFile( javadocJar );
+
+        File contentDirectory = javadocFiles;
+        if ( !contentDirectory.exists() )
+        {
+            getLog().warn( "JAR will be empty - no content was marked for 
inclusion!" );
+        }
+        else
+        {
+            archiver.getArchiver().addDirectory( contentDirectory, 
DEFAULT_INCLUDES, DEFAULT_EXCLUDES );
+        }
+
+        List<Resource> resources = project.getBuild().getResources();
+
+        for ( Resource r : resources )
+        {
+            if ( r.getDirectory().endsWith( "maven-shared-archive-resources" ) 
)
+            {
+                archiver.getArchiver().addDirectory( new File( 
r.getDirectory() ) );
+            }
+        }
+
+        if ( useDefaultManifestFile && defaultManifestFile.exists() && 
archive.getManifestFile() == null )
+        {
+            getLog().info( "Adding existing MANIFEST to archive. Found under: 
" + defaultManifestFile.getPath() );
+            archive.setManifestFile( defaultManifestFile );
+        }
+
+        try
+        {
+            archiver.createArchive( session, project, archive );
+        }
+        catch ( ManifestException e )
+        {
+            throw new ArchiverException( "ManifestException: " + 
e.getMessage(), e );
+        }
+        catch ( DependencyResolutionRequiredException e )
+        {
+            throw new ArchiverException( 
"DependencyResolutionRequiredException: " + e.getMessage(), e );
+        }
+
+        return javadocJar;
+    }
+}

Added: 
maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugins/javadoc/JavadocNoForkReport.java
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugins/javadoc/JavadocNoForkReport.java?rev=1801772&view=auto
==============================================================================
--- 
maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugins/javadoc/JavadocNoForkReport.java
 (added)
+++ 
maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugins/javadoc/JavadocNoForkReport.java
 Wed Jul 12 19:59:51 2017
@@ -0,0 +1,43 @@
+package org.apache.maven.plugins.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 org.apache.maven.plugins.annotations.Execute;
+import org.apache.maven.plugins.annotations.LifecyclePhase;
+import org.apache.maven.plugins.annotations.Mojo;
+import org.apache.maven.plugins.annotations.ResolutionScope;
+
+/**
+ * Generates documentation for the <code>Java code</code> in an <b>NON 
aggregator</b> project using the standard
+ * <a 
href="http://docs.oracle.com/javase/7/docs/technotes/guides/javadoc/";>Javadoc 
Tool</a>. Note that this
+ * goal does require generation of sources before site generation, e.g. by 
invoking <tt>mvn clean deploy site</tt>.
+ *
+ * @author <a href="mailto:mfriedenha...@apache.org";>Mirko Friedenhagen</a>
+ * @version $Id$
+ * @since 2.10
+ * @see <a 
href="http://docs.oracle.com/javase/7/docs/technotes/guides/javadoc/";>Javadoc 
Tool</a>
+ * @see <a 
href="http://docs.oracle.com/javase/1.4.2/docs/tooldocs/windows/javadoc.html#options";>Javadoc
 Options</a>
+ */
+@Mojo( name = "javadoc-no-fork", requiresDependencyResolution = 
ResolutionScope.COMPILE, threadSafe = true )
+@Execute( phase = LifecyclePhase.NONE )
+public class JavadocNoForkReport
+    extends JavadocReport
+{
+}

Added: 
maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugins/javadoc/JavadocReport.java
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugins/javadoc/JavadocReport.java?rev=1801772&view=auto
==============================================================================
--- 
maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugins/javadoc/JavadocReport.java
 (added)
+++ 
maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugins/javadoc/JavadocReport.java
 Wed Jul 12 19:59:51 2017
@@ -0,0 +1,340 @@
+package org.apache.maven.plugins.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.io.File;
+import java.util.List;
+import java.util.Locale;
+import java.util.ResourceBundle;
+
+import org.apache.maven.doxia.siterenderer.RenderingContext;
+import org.apache.maven.doxia.siterenderer.sink.SiteRendererSink;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.plugins.annotations.Execute;
+import org.apache.maven.plugins.annotations.LifecyclePhase;
+import org.apache.maven.plugins.annotations.Mojo;
+import org.apache.maven.plugins.annotations.Parameter;
+import org.apache.maven.plugins.annotations.ResolutionScope;
+import org.apache.maven.reporting.MavenReport;
+import org.apache.maven.reporting.MavenReportException;
+import org.codehaus.doxia.sink.Sink;
+import org.codehaus.plexus.util.StringUtils;
+
+/**
+ * Generates documentation for the <code>Java code</code> in an <b>NON 
aggregator</b> project using the standard
+ * <a 
href="http://docs.oracle.com/javase/7/docs/technotes/guides/javadoc/";>Javadoc 
Tool</a>.
+ *
+ * @author <a href="mailto:eveni...@apache.org";>Emmanuel Venisse</a>
+ * @author <a href="mailto:vincent.sive...@gmail.com";>Vincent Siveton</a>
+ * @version $Id: JavadocReport.java 1800564 2017-07-02 14:08:18Z michaelo $
+ * @since 2.0
+ * @see <a 
href="http://docs.oracle.com/javase/7/docs/technotes/guides/javadoc/";>Javadoc 
Tool</a>
+ * @see <a 
href="http://docs.oracle.com/javase/7/docs/technotes/tools/windows/javadoc.html#options";>Javadoc
 Options</a>
+ */
+@Mojo( name = "javadoc", requiresDependencyResolution = 
ResolutionScope.COMPILE, threadSafe = true )
+@Execute( phase = LifecyclePhase.GENERATE_SOURCES )
+public class JavadocReport
+    extends AbstractJavadocMojo
+    implements MavenReport
+{
+    // ----------------------------------------------------------------------
+    // Report Mojo Parameters
+    // ----------------------------------------------------------------------
+
+    /**
+     * Specifies the destination directory where javadoc saves the generated 
HTML files.
+     */
+    @Parameter( property = "reportOutputDirectory", defaultValue = 
"${project.reporting.outputDirectory}/apidocs",
+                required = true )
+    private File reportOutputDirectory;
+
+    /**
+     * The name of the destination directory.
+     * <br/>
+     *
+     * @since 2.1
+     */
+    @Parameter( property = "destDir", defaultValue = "apidocs" )
+    private String destDir;
+
+    /**
+     * The name of the Javadoc report to be displayed in the Maven Generated 
Reports page
+     * (i.e. <code>project-reports.html</code>).
+     *
+     * @since 2.1
+     */
+    @Parameter( property = "name" )
+    private String name;
+
+    /**
+     * The description of the Javadoc report to be displayed in the Maven 
Generated Reports page
+     * (i.e. <code>project-reports.html</code>).
+     *
+     * @since 2.1
+     */
+    @Parameter( property = "description" )
+    private String description;
+
+    // ----------------------------------------------------------------------
+    // Report public methods
+    // ----------------------------------------------------------------------
+
+    /** {@inheritDoc} */
+    public String getName( Locale locale )
+    {
+        if ( StringUtils.isEmpty( name ) )
+        {
+            return getBundle( locale ).getString( "report.javadoc.name" );
+        }
+
+        return name;
+    }
+
+    /** {@inheritDoc} */
+    public String getDescription( Locale locale )
+    {
+        if ( StringUtils.isEmpty( description ) )
+        {
+            return getBundle( locale ).getString( "report.javadoc.description" 
);
+        }
+
+        return description;
+    }
+
+    /** {@inheritDoc} */
+    public void generate( Sink sink, Locale locale )
+        throws MavenReportException
+    {
+        outputDirectory = getReportOutputDirectory();
+
+        try
+        {
+            executeReport( locale );
+        }
+        catch ( MavenReportException e )
+        {
+            if ( failOnError )
+            {
+                throw e;
+            }
+            getLog().error( "Error while creating javadoc report: " + 
e.getMessage(), e );
+        }
+        catch ( RuntimeException e )
+        {
+            if ( failOnError )
+            {
+                throw e;
+            }
+            getLog().error( "Error while creating javadoc report: " + 
e.getMessage(), e );
+        }
+    }
+
+    /** {@inheritDoc} */
+    public String getOutputName()
+    {
+        return destDir + "/index";
+    }
+
+    /** {@inheritDoc} */
+    public boolean isExternalReport()
+    {
+        return true;
+    }
+
+    /**
+     * {@inheritDoc}
+     *
+     * <br/>
+     * The logic is the following:
+     * <table>
+     *   <tbody>
+     *     <tr>
+     *       <th> isAggregator </th>
+     *       <th> hasSourceFiles </th>
+     *       <th> isRootProject </th>
+     *       <th> Generate Report </th>
+     *     </tr>
+     *     <tr>
+     *       <td>True</td>
+     *       <td>True</td>
+     *       <td>True</td>
+     *       <td>True</td>
+     *     </tr>
+     *     <tr>
+     *       <td>True</td>
+     *       <td>True</td>
+     *       <td>False</td>
+     *       <td>False</td>
+     *     </tr>
+     *     <tr>
+     *       <td>True</td>
+     *       <td>False</td>
+     *       <td>True</td>
+     *       <td>False</td>
+     *     </tr>
+     *     <tr>
+     *       <td>True</td>
+     *       <td>False</td>
+     *       <td>False</td>
+     *       <td>False</td>
+     *     </tr>
+     *     <tr>
+     *       <td>False</td>
+     *       <td>True</td>
+     *       <td>True</td>
+     *       <td>True</td>
+     *     </tr>
+     *     <tr>
+     *       <td>False</td>
+     *       <td>True</td>
+     *       <td>False</td>
+     *       <td>True</td>
+     *     </tr>
+     *     <tr>
+     *        <td>False</td>
+     *        <td>False</td>
+     *        <td>True</td>
+     *        <td>False</td>
+     *      </tr>
+     *      <tr>
+     *        <td>False</td>
+     *        <td>False</td>
+     *        <td>False</td>
+     *        <td>False</td>
+     *      </tr>
+     *    </tbody>
+     *  </table>
+     */
+    public boolean canGenerateReport()
+    {
+        boolean canGenerate = false;
+
+        if ( !this.isAggregator() || ( this.isAggregator() && 
this.project.isExecutionRoot() ) )
+        {
+            List<String> sourcePaths;
+            List<String> files;
+            try
+            {
+                sourcePaths = getSourcePaths();
+                files = getFiles( sourcePaths );
+            }
+            catch ( MavenReportException e )
+            {
+                getLog().error( e.getMessage(), e );
+                return false;
+            }
+
+            canGenerate = canGenerateReport( files );
+        }
+        if ( getLog().isDebugEnabled() )
+        {
+            getLog().debug( " canGenerateReport = " + canGenerate + " for 
project " + this.project );
+        }
+        return canGenerate;
+    }
+
+    /** {@inheritDoc} */
+    public String getCategoryName()
+    {
+        return CATEGORY_PROJECT_REPORTS;
+    }
+
+    /** {@inheritDoc} */
+    public File getReportOutputDirectory()
+    {
+        if ( reportOutputDirectory == null )
+        {
+            return outputDirectory;
+        }
+
+        return reportOutputDirectory;
+    }
+
+    /**
+     * Method to set the directory where the generated reports will be put
+     *
+     * @param reportOutputDirectory the directory file to be set
+     */
+    public void setReportOutputDirectory( File reportOutputDirectory )
+    {
+        updateReportOutputDirectory( reportOutputDirectory, destDir );
+    }
+
+    /**
+     * @param theDestDir The destiation directory.
+     */
+    public void setDestDir( String theDestDir )
+    {
+        this.destDir = theDestDir;
+        updateReportOutputDirectory( reportOutputDirectory, theDestDir );
+    }
+
+    private void updateReportOutputDirectory( File reportOutputDirectory, 
String destDir )
+    {
+        if ( reportOutputDirectory != null && destDir != null
+             && !reportOutputDirectory.getAbsolutePath().endsWith( destDir ) )
+        {
+            this.reportOutputDirectory = new File( reportOutputDirectory, 
destDir );
+        }
+        else
+        {
+            this.reportOutputDirectory = reportOutputDirectory;
+        }
+    }
+
+    /** {@inheritDoc} */
+    public void doExecute()
+        throws MojoExecutionException, MojoFailureException
+    {
+        if ( skip )
+        {
+            getLog().info( "Skipping javadoc generation" );
+            return;
+        }
+
+        try
+        {
+            RenderingContext context = new RenderingContext( outputDirectory, 
getOutputName() + ".html" );
+            SiteRendererSink sink = new SiteRendererSink( context );
+            Locale locale = Locale.getDefault();
+            generate( sink, locale );
+        }
+        catch ( MavenReportException e )
+        {
+            failOnError( "An error has occurred in " + getName( Locale.ENGLISH 
) + " report generation", e );
+        }
+        catch ( RuntimeException e )
+        {
+            failOnError( "An error has occurred in " + getName( Locale.ENGLISH 
) + " report generation", e );
+        }
+    }
+
+    /**
+     * Gets the resource bundle for the specified locale.
+     *
+     * @param locale The locale of the currently generated report.
+     * @return The resource bundle for the requested locale.
+     */
+    private ResourceBundle getBundle( Locale locale )
+    {
+        return ResourceBundle.getBundle( "javadoc-report", locale, 
getClass().getClassLoader() );
+    }
+}


Reply via email to