You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by rf...@apache.org on 2016/07/09 16:35:25 UTC

svn commit: r1752018 - in /maven/plugins/trunk/maven-javadoc-plugin/src: it/MJAVADOC-172/ it/MJAVADOC-180/ main/java/org/apache/maven/plugin/javadoc/ test/java/org/apache/maven/plugin/javadoc/ test/resources/unit/aggregate-resources-test/ test/resource...

Author: rfscholte
Date: Sat Jul  9 16:35:25 2016
New Revision: 1752018

URL: http://svn.apache.org/viewvc?rev=1752018&view=rev
Log:
[MJAVADOC-457] Clean up mojo parameters
Remove aggregator parameter, use the separate goal instead

Modified:
    maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-172/pom.xml
    maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-180/invoker.properties
    maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-180/pom.xml
    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/main/java/org/apache/maven/plugin/javadoc/JavadocReport.java
    maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/ResourcesBundleMojo.java
    maven/plugins/trunk/maven-javadoc-plugin/src/test/java/org/apache/maven/plugin/javadoc/AbstractJavadocMojoTest.java
    maven/plugins/trunk/maven-javadoc-plugin/src/test/java/org/apache/maven/plugin/javadoc/JavadocJarTest.java
    maven/plugins/trunk/maven-javadoc-plugin/src/test/java/org/apache/maven/plugin/javadoc/JavadocReportTest.java
    maven/plugins/trunk/maven-javadoc-plugin/src/test/java/org/apache/maven/plugin/javadoc/TestJavadocReportTest.java
    maven/plugins/trunk/maven-javadoc-plugin/src/test/resources/unit/aggregate-resources-test/aggregate-resources-test-plugin-config.xml
    maven/plugins/trunk/maven-javadoc-plugin/src/test/resources/unit/aggregate-test/aggregate-test-plugin-config.xml

Modified: maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-172/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-172/pom.xml?rev=1752018&r1=1752017&r2=1752018&view=diff
==============================================================================
--- maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-172/pom.xml (original)
+++ maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-172/pom.xml Sat Jul  9 16:35:25 2016
@@ -60,11 +60,8 @@
             <id>javadoc</id>
             <phase>package</phase>
             <goals>
-              <goal>javadoc</goal>
+              <goal>aggregate</goal>
             </goals>
-            <configuration>
-              <aggregate>true</aggregate>
-            </configuration>
           </execution>
         </executions>
       </plugin>

Modified: maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-180/invoker.properties
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-180/invoker.properties?rev=1752018&r1=1752017&r2=1752018&view=diff
==============================================================================
--- maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-180/invoker.properties (original)
+++ maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-180/invoker.properties Sat Jul  9 16:35:25 2016
@@ -15,4 +15,4 @@
 # specific language governing permissions and limitations
 # under the License.
 
-invoker.goals=clean javadoc:test-javadoc
+invoker.goals=clean javadoc:test-aggregate

Modified: maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-180/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-180/pom.xml?rev=1752018&r1=1752017&r2=1752018&view=diff
==============================================================================
--- maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-180/pom.xml (original)
+++ maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-180/pom.xml Sat Jul  9 16:35:25 2016
@@ -41,10 +41,7 @@
         <plugin>
           <groupId>org.apache.maven.plugins</groupId>
           <artifactId>maven-javadoc-plugin</artifactId>
-          <version>@pom.version@</version>
-          <configuration>
-            <aggregate>true</aggregate>
-          </configuration>
+          <version>@project.version@</version>
         </plugin>
       </plugins>
     </pluginManagement>
@@ -81,14 +78,12 @@
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-javadoc-plugin</artifactId>
-        <version>@pom.version@</version>
+        <version>@project.version@</version>
         <inherited>true</inherited>
         <configuration>
           <debug>true</debug>
           <quiet>true</quiet>
           <verbose>false</verbose>
-          <!-- to workaround MJAVADOC-180, aggregate must be false -->
-          <aggregate>true</aggregate>
           <show>protected</show>
           <links>
             <link>http://java.sun.com/j2se/1.5.0/docs/api/</link>

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=1752018&r1=1752017&r2=1752018&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 Sat Jul  9 16:35:25 2016
@@ -77,6 +77,8 @@ import org.apache.maven.model.Plugin;
 import org.apache.maven.model.Resource;
 import org.apache.maven.plugin.AbstractMojo;
 import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.plugin.descriptor.PluginDescriptor;
 import org.apache.maven.plugin.javadoc.options.BootclasspathArtifact;
 import org.apache.maven.plugin.javadoc.options.DocletArtifact;
 import org.apache.maven.plugin.javadoc.options.Group;
@@ -359,6 +361,9 @@ public abstract class AbstractJavadocMoj
      */
     @Parameter( defaultValue = "${project}", readonly = true, required = true )
     protected MavenProject project;
+    
+    @Parameter( defaultValue = "${plugin}", readonly = true )
+    private PluginDescriptor plugin;
 
     /**
      * Specify if the Javadoc should operate in offline mode.
@@ -453,15 +458,6 @@ public abstract class AbstractJavadocMoj
     private List<MavenProject> reactorProjects;
 
     /**
-     * Whether to build an aggregated report at the root, or build individual reports.
-     *
-     * @deprecated since 2.5. Use the goals <code>javadoc:aggregate</code> and <code>javadoc:test-aggregate</code>
-     * instead.
-     */
-    @Parameter( property = "aggregate", defaultValue = "false" )
-    protected boolean aggregate;
-
-    /**
      * Set this to <code>true</code> to debug the Javadoc plugin. With this, <code>javadoc.bat(or.sh)</code>,
      * <code>options</code>, <code>@packages</code> or <code>argfile</code> files are provided in the output directory.
      * <br/>
@@ -1880,6 +1876,34 @@ public abstract class AbstractJavadocMoj
         return ( StringUtils.isEmpty( encoding ) ) ? ReaderFactory.FILE_ENCODING : encoding;
     }
 
+    @Override
+    public void execute()
+        throws MojoExecutionException, MojoFailureException
+    {
+        verifyRemovedParameter( "aggregator" );
+        verifyRemovedParameter( "proxyHost" );
+        verifyRemovedParameter( "proxyPort" );
+        
+        doExecute();
+    }
+    
+    abstract void doExecute() throws MojoExecutionException, MojoFailureException;
+    
+    private void verifyRemovedParameter( String paramName )
+    {
+        Object pluginConfiguration = plugin.getPlugin().getConfiguration();
+        if ( pluginConfiguration instanceof Xpp3Dom )
+        {
+            Xpp3Dom configDom = (Xpp3Dom) pluginConfiguration;
+            
+            if ( configDom.getChild( paramName ) != null )
+            {
+                throw new IllegalArgumentException( "parameter '" + paramName
+                    + "' has been removed from the plugin, please verify documentation." );
+            }
+        }
+    }
+    
     /**
      * The <a href="package-summary.html">package documentation</a> details the
      * Javadoc Options used by this Plugin.

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=1752018&r1=1752017&r2=1752018&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 Sat Jul  9 16:35:25 2016
@@ -158,7 +158,7 @@ public class JavadocJar
     private String classifier;
 
     /** {@inheritDoc} */
-    public void execute()
+    public void doExecute()
         throws MojoExecutionException
     {
         if ( skip )

Modified: maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/JavadocReport.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/JavadocReport.java?rev=1752018&r1=1752017&r2=1752018&view=diff
==============================================================================
--- maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/JavadocReport.java (original)
+++ maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/JavadocReport.java Sat Jul  9 16:35:25 2016
@@ -301,7 +301,7 @@ public class JavadocReport
     }
 
     /** {@inheritDoc} */
-    public void execute()
+    public void doExecute()
         throws MojoExecutionException, MojoFailureException
     {
         if ( skip )
@@ -327,13 +327,6 @@ public class JavadocReport
         }
     }
 
-    @Override
-    protected boolean isAggregator()
-    {
-        // only here for backward compatibility, this flag does not work reliably
-        return aggregate;
-    }
-
     /**
      * Gets the resource bundle for the specified locale.
      *

Modified: maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/ResourcesBundleMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/ResourcesBundleMojo.java?rev=1752018&r1=1752017&r2=1752018&view=diff
==============================================================================
--- maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/ResourcesBundleMojo.java (original)
+++ maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/ResourcesBundleMojo.java Sat Jul  9 16:35:25 2016
@@ -91,7 +91,7 @@ extends AbstractJavadocMojo
      * {@inheritDoc}
      * @see org.apache.maven.plugin.Mojo#execute()
      */
-    public void execute()
+    public void doExecute()
         throws MojoExecutionException, MojoFailureException
     {
         try

Modified: maven/plugins/trunk/maven-javadoc-plugin/src/test/java/org/apache/maven/plugin/javadoc/AbstractJavadocMojoTest.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/test/java/org/apache/maven/plugin/javadoc/AbstractJavadocMojoTest.java?rev=1752018&r1=1752017&r2=1752018&view=diff
==============================================================================
--- maven/plugins/trunk/maven-javadoc-plugin/src/test/java/org/apache/maven/plugin/javadoc/AbstractJavadocMojoTest.java (original)
+++ maven/plugins/trunk/maven-javadoc-plugin/src/test/java/org/apache/maven/plugin/javadoc/AbstractJavadocMojoTest.java Sat Jul  9 16:35:25 2016
@@ -47,7 +47,7 @@ public class AbstractJavadocMojoTest
         mojo = new AbstractJavadocMojo()
         {
             @Override
-            public void execute()
+            public void doExecute()
                 throws MojoExecutionException, MojoFailureException
             {
             }

Modified: maven/plugins/trunk/maven-javadoc-plugin/src/test/java/org/apache/maven/plugin/javadoc/JavadocJarTest.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/test/java/org/apache/maven/plugin/javadoc/JavadocJarTest.java?rev=1752018&r1=1752017&r2=1752018&view=diff
==============================================================================
--- maven/plugins/trunk/maven-javadoc-plugin/src/test/java/org/apache/maven/plugin/javadoc/JavadocJarTest.java (original)
+++ maven/plugins/trunk/maven-javadoc-plugin/src/test/java/org/apache/maven/plugin/javadoc/JavadocJarTest.java Sat Jul  9 16:35:25 2016
@@ -19,8 +19,6 @@ package org.apache.maven.plugin.javadoc;
  * under the License.
  */
 
-import org.apache.maven.plugin.testing.AbstractMojoTestCase;
-import org.codehaus.plexus.util.FileUtils;
 
 import java.io.File;
 import java.util.ArrayList;
@@ -31,12 +29,31 @@ import java.util.Set;
 import java.util.zip.ZipEntry;
 import java.util.zip.ZipFile;
 
+import org.apache.maven.model.Plugin;
+import org.apache.maven.plugin.descriptor.PluginDescriptor;
+import org.apache.maven.plugin.testing.AbstractMojoTestCase;
+import org.codehaus.plexus.util.FileUtils;
+
 /**
  * @author <a href="mailto:oching@apache.org">Maria Odea Ching</a>
  */
 public class JavadocJarTest
     extends AbstractMojoTestCase
 {
+    
+    private JavadocJar lookupMojo( File testPom )
+                    throws Exception
+    {
+        JavadocJar mojo = (JavadocJar) lookupMojo( "jar", testPom );
+        
+        PluginDescriptor pluginDescriptor = new PluginDescriptor();
+        pluginDescriptor.setPlugin( new Plugin() );
+        
+        setVariableValueToObject( mojo, "plugin", pluginDescriptor );
+        return mojo;
+    }
+
+
     /**
      * Test when default configuration is provided
      *
@@ -47,7 +64,7 @@ public class JavadocJarTest
     {
         File testPom =
             new File( getBasedir(), "src/test/resources/unit/javadocjar-default/javadocjar-default-plugin-config.xml" );
-        JavadocJar mojo = (JavadocJar) lookupMojo( "jar", testPom );
+        JavadocJar mojo = lookupMojo( testPom );
         mojo.execute();
 
         //check if the javadoc jar file was generated
@@ -115,7 +132,7 @@ public class JavadocJarTest
     {
         File testPom = new File( getBasedir(),
                                  "src/test/resources/unit/javadocjar-invalid-destdir/javadocjar-invalid-destdir-plugin-config.xml" );
-        JavadocJar mojo = (JavadocJar) lookupMojo( "jar", testPom );
+        JavadocJar mojo = lookupMojo( testPom );
         mojo.execute();
 
         //check if the javadoc jar file was generated
@@ -128,7 +145,7 @@ public class JavadocJarTest
     {
         File testPom =
                 new File( getBasedir(), "src/test/resources/unit/javadocjar-failonerror/javadocjar-failonerror-plugin-config.xml" );
-        JavadocJar mojo = (JavadocJar) lookupMojo( "jar", testPom );
+        JavadocJar mojo = lookupMojo( testPom );
         mojo.execute();
 
         //check if the javadoc jar file was generated
@@ -141,7 +158,7 @@ public class JavadocJarTest
     {
         File testPom =
                 new File( getBasedir(), "src/test/resources/unit/javadocjar-archive-config/javadocjar-archive-config.xml" );
-        JavadocJar mojo = (JavadocJar) lookupMojo( "jar", testPom );
+        JavadocJar mojo = lookupMojo( testPom );
         mojo.execute();
 
         //check if the javadoc jar file was generated

Modified: maven/plugins/trunk/maven-javadoc-plugin/src/test/java/org/apache/maven/plugin/javadoc/JavadocReportTest.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/test/java/org/apache/maven/plugin/javadoc/JavadocReportTest.java?rev=1752018&r1=1752017&r2=1752018&view=diff
==============================================================================
--- maven/plugins/trunk/maven-javadoc-plugin/src/test/java/org/apache/maven/plugin/javadoc/JavadocReportTest.java (original)
+++ maven/plugins/trunk/maven-javadoc-plugin/src/test/java/org/apache/maven/plugin/javadoc/JavadocReportTest.java Sat Jul  9 16:35:25 2016
@@ -33,8 +33,10 @@ import java.util.Map;
 
 import org.apache.commons.lang.SystemUtils;
 import org.apache.maven.execution.MavenSession;
+import org.apache.maven.model.Plugin;
 import org.apache.maven.plugin.LegacySupport;
 import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.descriptor.PluginDescriptor;
 import org.apache.maven.plugin.javadoc.ProxyServer.AuthAsyncProxyServlet;
 import org.apache.maven.plugin.testing.AbstractMojoTestCase;
 import org.apache.maven.project.ProjectBuildingRequest;
@@ -77,6 +79,19 @@ public class JavadocReportTest
         
         createTestRepo();
     }
+    
+
+    private JavadocReport lookupMojo( File testPom )
+        throws Exception
+    {
+        JavadocReport mojo = (JavadocReport) lookupMojo( "javadoc", testPom );
+
+        PluginDescriptor pluginDescriptor = new PluginDescriptor();
+        pluginDescriptor.setPlugin( new Plugin() );
+        
+        setVariableValueToObject( mojo, "plugin", pluginDescriptor );
+        return mojo;
+    }
 
     /**
      * Create test repository in target directory.
@@ -196,7 +211,7 @@ public class JavadocReportTest
         throws Exception
     {
         File testPom = new File( unit, "default-configuration/default-configuration-plugin-config.xml" );
-        JavadocReport mojo = (JavadocReport) lookupMojo( "javadoc", testPom );
+        JavadocReport mojo = lookupMojo( testPom );
         mojo.execute();
 
         // package level generated javadoc files
@@ -238,7 +253,7 @@ public class JavadocReportTest
         throws Exception
     {
         File testPom = new File( unit, "subpackages-test/subpackages-test-plugin-config.xml" );
-        JavadocReport mojo = (JavadocReport) lookupMojo( "javadoc", testPom );
+        JavadocReport mojo = lookupMojo( testPom );
         mojo.execute();
 
         File apidocs = new File( getBasedir(), "target/test/unit/subpackages-test/target/site/apidocs" );
@@ -258,7 +273,7 @@ public class JavadocReportTest
             throws Exception
     {
         File testPom = new File( unit, "file-include-exclude-test/file-include-exclude-plugin-config.xml" );
-        JavadocReport mojo = (JavadocReport) lookupMojo( "javadoc", testPom );
+        JavadocReport mojo = lookupMojo( testPom );
         mojo.execute();
 
         File apidocs = new File( getBasedir(), "target/test/unit/file-include-exclude-test/target/site/apidocs" );
@@ -280,7 +295,7 @@ public class JavadocReportTest
         throws Exception
     {
         File testPom = new File( unit, "docfiles-test/docfiles-test-plugin-config.xml" );
-        JavadocReport mojo = (JavadocReport) lookupMojo( "javadoc", testPom );
+        JavadocReport mojo = lookupMojo( testPom );
         mojo.execute();
 
         File apidocs = new File( getBasedir(), "target/test/unit/docfiles-test/target/site/apidocs/" );
@@ -293,7 +308,7 @@ public class JavadocReportTest
         assertFalse( new File( apidocs, "doc-files/excluded-dir2" ).exists() );
 
         testPom = new File( unit, "docfiles-with-java-test/docfiles-with-java-test-plugin-config.xml" );
-        mojo = (JavadocReport) lookupMojo( "javadoc", testPom );
+        mojo = lookupMojo( testPom );
         mojo.execute();
     }
 
@@ -307,7 +322,7 @@ public class JavadocReportTest
         throws Exception
     {
         File testPom = new File( unit, "custom-configuration/custom-configuration-plugin-config.xml" );
-        JavadocReport mojo = (JavadocReport) lookupMojo( "javadoc", testPom );
+        JavadocReport mojo = lookupMojo( testPom );
         mojo.execute();
 
         File apidocs = new File( getBasedir(), "target/test/unit/custom-configuration/target/site/apidocs" );
@@ -385,7 +400,7 @@ public class JavadocReportTest
         // ----------------------------------------------------------------------
 
         File testPom = new File( unit, "doclet-test/doclet-test-plugin-config.xml" );
-        JavadocReport mojo = (JavadocReport) lookupMojo( "javadoc", testPom );
+        JavadocReport mojo = lookupMojo( testPom );
         
         MavenSession session = spy( newMavenSession( mojo.project ) );
         ProjectBuildingRequest buildingRequest = mock( ProjectBuildingRequest.class );
@@ -416,7 +431,7 @@ public class JavadocReportTest
         // ----------------------------------------------------------------------
 
         testPom = new File( unit, "doclet-path-test/doclet-path-test-plugin-config.xml" );
-        mojo = (JavadocReport) lookupMojo( "javadoc", testPom );
+        mojo = lookupMojo( testPom );
         setVariableValueToObject( mojo, "session", session );
         mojo.execute();
 
@@ -430,33 +445,7 @@ public class JavadocReportTest
         assertTrue( options.contains( "/target/local-repo/umlgraph/UMLGraph-bis/2.1/UMLGraph-bis-2.1.jar" ) );
     }
 
-    /**
-     * Method to test the aggregate parameter
-     *
-     * @throws Exception if any
-     */
-    public void testAggregate()
-        throws Exception
-    {
-        File testPom = new File( unit, "aggregate-test/aggregate-test-plugin-config.xml" );
-        JavadocReport mojo = (JavadocReport) lookupMojo( "aggregate", testPom );
-        mojo.execute();
-
-        File apidocs = new File( getBasedir(), "target/test/unit/aggregate-test/target/site/apidocs/" );
-
-        // check if project1 api files exist
-        assertTrue( new File( apidocs, "aggregate/test/project1/Project1App.html" ).exists() );
-        assertTrue( new File( apidocs, "aggregate/test/project1/Project1AppSample.html" ).exists() );
-        assertTrue( new File( apidocs, "aggregate/test/project1/Project1Sample.html" ).exists() );
-        assertTrue( new File( apidocs, "aggregate/test/project1/Project1Test.html" ).exists() );
-
-        // check if project2 api files exist
-        assertTrue( new File( apidocs, "aggregate/test/project2/Project2App.html" ).exists() );
-        assertTrue( new File( apidocs, "aggregate/test/project2/Project2AppSample.html" ).exists() );
-        assertTrue( new File( apidocs, "aggregate/test/project2/Project2Sample.html" ).exists() );
-        assertTrue( new File( apidocs, "aggregate/test/project2/Project2Test.html" ).exists() );
-
-    }
+    
 
     /**
      * Method to test when the path to the project sources has an apostrophe (')
@@ -467,7 +456,7 @@ public class JavadocReportTest
         throws Exception
     {
         File testPom = new File( unit, "quotedpath'test/quotedpath-test-plugin-config.xml" );
-        JavadocReport mojo = (JavadocReport) lookupMojo( "javadoc", testPom );
+        JavadocReport mojo = lookupMojo( testPom );
         mojo.execute();
 
         File apidocs = new File( getBasedir(), "target/test/unit/quotedpath'test/target/site/apidocs" );
@@ -493,7 +482,7 @@ public class JavadocReportTest
         try
         {
             File testPom = new File( unit, "default-configuration/exception-test-plugin-config.xml" );
-            JavadocReport mojo = (JavadocReport) lookupMojo( "javadoc", testPom );
+            JavadocReport mojo = lookupMojo( testPom );
             mojo.execute();
 
             fail( "Must throw exception." );
@@ -526,7 +515,7 @@ public class JavadocReportTest
         // ----------------------------------------------------------------------
 
         File testPom = new File( unit, "taglet-test/taglet-test-plugin-config.xml" );
-        JavadocReport mojo = (JavadocReport) lookupMojo( "javadoc", testPom );
+        JavadocReport mojo = lookupMojo( testPom );
         
         MavenSession session = spy( newMavenSession( mojo.project ) );
         ProjectBuildingRequest buildingRequest = mock( ProjectBuildingRequest.class );
@@ -562,7 +551,7 @@ public class JavadocReportTest
         throws Exception
     {
         File testPom = new File( unit, "jdk5-test/jdk5-test-plugin-config.xml" );
-        JavadocReport mojo = (JavadocReport) lookupMojo( "javadoc", testPom );
+        JavadocReport mojo = lookupMojo( testPom );
         mojo.execute();
 
         File apidocs = new File( getBasedir(), "target/test/unit/jdk5-test/target/site/apidocs" );
@@ -594,7 +583,7 @@ public class JavadocReportTest
         System.setProperty( "java.home", "foo/bar" );
 
         File testPom = new File( unit, "javaHome-test/javaHome-test-plugin-config.xml" );
-        JavadocReport mojo = (JavadocReport) lookupMojo( "javadoc", testPom );
+        JavadocReport mojo = lookupMojo( testPom );
         mojo.execute();
 
         System.setProperty( "java.home", oldJreHome );
@@ -609,7 +598,7 @@ public class JavadocReportTest
         throws Exception
     {
         File testPom = new File( unit, "resources-test/resources-test-plugin-config.xml" );
-        JavadocReport mojo = (JavadocReport) lookupMojo( "javadoc", testPom );
+        JavadocReport mojo = lookupMojo( testPom );
         mojo.execute();
 
         File apidocs = new File( getBasedir(), "target/test/unit/resources-test/target/site/apidocs/" );
@@ -628,7 +617,7 @@ public class JavadocReportTest
 
         // with excludes
         testPom = new File( unit, "resources-with-excludes-test/resources-with-excludes-test-plugin-config.xml" );
-        mojo = (JavadocReport) lookupMojo( "javadoc", testPom );
+        mojo = lookupMojo( testPom );
         mojo.execute();
 
         apidocs = new File( getBasedir(), "target/test/unit/resources-with-excludes-test/target/site/apidocs" );
@@ -657,38 +646,6 @@ public class JavadocReportTest
     }
 
     /**
-     * Test the javadoc resources in the aggregation case.
-     *
-     * @throws Exception if any
-     */
-    public void testAggregateJavadocResources()
-        throws Exception
-    {
-        File testPom = new File( unit, "aggregate-resources-test/aggregate-resources-test-plugin-config.xml" );
-        JavadocReport mojo = (JavadocReport) lookupMojo( "aggregate", testPom );
-        mojo.execute();
-
-        File apidocs = new File( getBasedir(), "target/test/unit/aggregate-resources-test/target/site/apidocs" );
-
-        // Test overview
-        File overviewSummary = new File( apidocs, "overview-summary.html" );
-        assertTrue( overviewSummary.exists() );
-        String overview = readFile( overviewSummary ).toLowerCase();
-        assertTrue( overview.contains( "<a href=\"resources/test/package-summary.html\">resources.test</a>" ) );
-        assertTrue( overview.contains( ">blabla</" ) );
-        assertTrue( overview.contains( "<a href=\"resources/test2/package-summary.html\">resources.test2</a>" ) );
-        assertTrue( overview.contains( "<a href=\"resources2/test/package-summary.html\">resources2.test</a>" ) );
-        assertTrue( overview.contains( "<a href=\"resources2/test2/package-summary.html\">resources2.test2</a>" ) );
-
-        // Test doc-files
-        File app = new File( apidocs, "resources/test/App.html" );
-        assertTrue( app.exists() );
-        overview = readFile( app );
-        assertTrue( overview.contains( "<img src=\"doc-files/maven-feather.png\" alt=\"Maven\">" ) );
-        assertTrue( new File( apidocs, "resources/test/doc-files/maven-feather.png" ).exists() );
-    }
-
-    /**
      * Test the javadoc for a POM project.
      *
      * @throws Exception if any
@@ -697,7 +654,7 @@ public class JavadocReportTest
         throws Exception
     {
         File testPom = new File( unit, "pom-test/pom-test-plugin-config.xml" );
-        JavadocReport mojo = (JavadocReport) lookupMojo( "javadoc", testPom );
+        JavadocReport mojo = lookupMojo( testPom );
         mojo.execute();
 
         assertFalse( new File( getBasedir(), "target/test/unit/pom-test/target/site" ).exists() );
@@ -712,7 +669,7 @@ public class JavadocReportTest
         throws Exception
     {
         File testPom = new File( unit, "tag-test/tag-test-plugin-config.xml" );
-        JavadocReport mojo = (JavadocReport) lookupMojo( "javadoc", testPom );
+        JavadocReport mojo = lookupMojo( testPom );
         mojo.execute();
 
         File app = new File( getBasedir(), "target/test/unit/tag-test/target/site/apidocs/tag/test/App.html" );
@@ -734,7 +691,7 @@ public class JavadocReportTest
         throws Exception
     {
         File testPom = new File( unit, "header-footer-test/header-footer-test-plugin-config.xml" );
-        JavadocReport mojo = (JavadocReport) lookupMojo( "javadoc", testPom );
+        JavadocReport mojo = lookupMojo( testPom );
         try
         {
             mojo.execute();
@@ -756,7 +713,7 @@ public class JavadocReportTest
         throws Exception
     {
         File testPom = new File( unit, "newline-test/newline-test-plugin-config.xml" );
-        JavadocReport mojo = (JavadocReport) lookupMojo( "javadoc", testPom );
+        JavadocReport mojo = lookupMojo( testPom );
         try
         {
             mojo.execute();
@@ -778,7 +735,7 @@ public class JavadocReportTest
         throws Exception
     {
         File testPom = new File( unit, "jdk6-test/jdk6-test-plugin-config.xml" );
-        JavadocReport mojo = (JavadocReport) lookupMojo( "javadoc", testPom );
+        JavadocReport mojo = lookupMojo( testPom );
         mojo.execute();
 
         File apidocs = new File( getBasedir(), "target/test/unit/jdk6-test/target/site/apidocs" );
@@ -822,7 +779,7 @@ public class JavadocReportTest
         settings.addProxy( proxy );
 
         File testPom = new File( getBasedir(), "src/test/resources/unit/proxy-test/proxy-test-plugin-config.xml" );
-        JavadocReport mojo = (JavadocReport) lookupMojo( "javadoc", testPom );
+        JavadocReport mojo = lookupMojo( testPom );
         
         MavenSession session = spy( newMavenSession( mojo.project ) );
         ProjectBuildingRequest buildingRequest = mock( ProjectBuildingRequest.class );
@@ -872,7 +829,7 @@ public class JavadocReportTest
             proxy.setProtocol( "http" );
             settings.addProxy( proxy );
 
-            mojo = (JavadocReport) lookupMojo( "javadoc", testPom );
+            mojo = lookupMojo( testPom );
             setVariableValueToObject( mojo, "settings", settings );
             setVariableValueToObject( mojo, "session", session );
             mojo.execute();
@@ -920,7 +877,7 @@ public class JavadocReportTest
             proxy.setPassword( "bar" );
             settings.addProxy( proxy );
 
-            mojo = (JavadocReport) lookupMojo( "javadoc", testPom );
+            mojo = lookupMojo( testPom );
             setVariableValueToObject( mojo, "settings", settings );
             setVariableValueToObject( mojo, "session", session );
             mojo.execute();
@@ -955,7 +912,7 @@ public class JavadocReportTest
     {
         // encoding
         File testPom = new File( unit, "validate-options-test/wrong-encoding-test-plugin-config.xml" );
-        JavadocReport mojo = (JavadocReport) lookupMojo( "javadoc", testPom );
+        JavadocReport mojo = lookupMojo( testPom );
         try
         {
             mojo.execute();
@@ -966,7 +923,7 @@ public class JavadocReportTest
             assertTrue( "No wrong encoding catch", e.getMessage().contains( "Unsupported option <encoding/>" ) );
         }
         testPom = new File( unit, "validate-options-test/wrong-docencoding-test-plugin-config.xml" );
-        mojo = (JavadocReport) lookupMojo( "javadoc", testPom );
+        mojo = lookupMojo( testPom );
         try
         {
             mojo.execute();
@@ -977,7 +934,7 @@ public class JavadocReportTest
             assertTrue( "No wrong docencoding catch", e.getMessage().contains( "Unsupported option <docencoding/>" ) );
         }
         testPom = new File( unit, "validate-options-test/wrong-charset-test-plugin-config.xml" );
-        mojo = (JavadocReport) lookupMojo( "javadoc", testPom );
+        mojo = lookupMojo( testPom );
         try
         {
             mojo.execute();
@@ -990,7 +947,7 @@ public class JavadocReportTest
 
         // locale
         testPom = new File( unit, "validate-options-test/wrong-locale-test-plugin-config.xml" );
-        mojo = (JavadocReport) lookupMojo( "javadoc", testPom );
+        mojo = lookupMojo( testPom );
         try
         {
             mojo.execute();
@@ -1001,13 +958,13 @@ public class JavadocReportTest
             assertTrue( "No wrong locale catch", e.getMessage().contains( "Unsupported option <locale/>" ) );
         }
         testPom = new File( unit, "validate-options-test/wrong-locale-with-variant-test-plugin-config.xml" );
-        mojo = (JavadocReport) lookupMojo( "javadoc", testPom );
+        mojo = lookupMojo( testPom );
         mojo.execute();
         assertTrue( "No wrong locale catch", true );
 
         // conflict options
         testPom = new File( unit, "validate-options-test/conflict-options-test-plugin-config.xml" );
-        mojo = (JavadocReport) lookupMojo( "javadoc", testPom );
+        mojo = lookupMojo( testPom );
         try
         {
             mojo.execute();
@@ -1028,7 +985,7 @@ public class JavadocReportTest
         throws Exception
     {
         File testPom = new File( unit, "tagletArtifacts-test/tagletArtifacts-test-plugin-config.xml" );
-        JavadocReport mojo = (JavadocReport) lookupMojo( "javadoc", testPom );
+        JavadocReport mojo = lookupMojo( testPom );
 
         MavenSession session = spy( newMavenSession( mojo.project ) );
         ProjectBuildingRequest buildingRequest = mock( ProjectBuildingRequest.class );
@@ -1081,7 +1038,7 @@ public class JavadocReportTest
     {
         File testPom = new File( unit, "stylesheetfile-test/pom.xml" );
 
-        JavadocReport mojo = (JavadocReport) lookupMojo( "javadoc", testPom );
+        JavadocReport mojo = lookupMojo( testPom );
         assertNotNull( mojo );
 
         MavenSession session = spy( newMavenSession( mojo.project ) );
@@ -1188,7 +1145,7 @@ public class JavadocReportTest
     {
         File testPom = new File( unit, "helpfile-test/pom.xml" );
         
-        JavadocReport mojo = (JavadocReport) lookupMojo( "javadoc", testPom );
+        JavadocReport mojo = lookupMojo( testPom );
         assertNotNull( mojo );
 
         MavenSession session = spy( newMavenSession( mojo.project ) );

Modified: maven/plugins/trunk/maven-javadoc-plugin/src/test/java/org/apache/maven/plugin/javadoc/TestJavadocReportTest.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/test/java/org/apache/maven/plugin/javadoc/TestJavadocReportTest.java?rev=1752018&r1=1752017&r2=1752018&view=diff
==============================================================================
--- maven/plugins/trunk/maven-javadoc-plugin/src/test/java/org/apache/maven/plugin/javadoc/TestJavadocReportTest.java (original)
+++ maven/plugins/trunk/maven-javadoc-plugin/src/test/java/org/apache/maven/plugin/javadoc/TestJavadocReportTest.java Sat Jul  9 16:35:25 2016
@@ -21,6 +21,8 @@ package org.apache.maven.plugin.javadoc;
 
 import java.io.File;
 
+import org.apache.maven.model.Plugin;
+import org.apache.maven.plugin.descriptor.PluginDescriptor;
 import org.apache.maven.plugin.testing.AbstractMojoTestCase;
 import org.codehaus.plexus.util.FileUtils;
 
@@ -42,6 +44,12 @@ public class TestJavadocReportTest
             new File( getBasedir(),
                       "src/test/resources/unit/test-javadoc-test/test-javadoc-test-plugin-config.xml" );
         TestJavadocReport mojo = (TestJavadocReport) lookupMojo( "test-javadoc", testPom );
+        
+        PluginDescriptor pluginDescriptor = new PluginDescriptor();
+        pluginDescriptor.setPlugin( new Plugin() );
+        
+        setVariableValueToObject( mojo, "plugin", pluginDescriptor );
+        
         mojo.execute();
 
         File generatedFile =

Modified: maven/plugins/trunk/maven-javadoc-plugin/src/test/resources/unit/aggregate-resources-test/aggregate-resources-test-plugin-config.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/test/resources/unit/aggregate-resources-test/aggregate-resources-test-plugin-config.xml?rev=1752018&r1=1752017&r2=1752018&view=diff
==============================================================================
--- maven/plugins/trunk/maven-javadoc-plugin/src/test/resources/unit/aggregate-resources-test/aggregate-resources-test-plugin-config.xml (original)
+++ maven/plugins/trunk/maven-javadoc-plugin/src/test/resources/unit/aggregate-resources-test/aggregate-resources-test-plugin-config.xml Sat Jul  9 16:35:25 2016
@@ -46,7 +46,6 @@ under the License.
           <show>protected</show>
           <groups/>
           <tags/>
-          <aggregate>true</aggregate>
           <quiet>true</quiet>
           <javadocDirectory>${basedir}/src/test/resources/unit/aggregate-resources-test/src/main/javadoc</javadocDirectory>
           <debug>true</debug>

Modified: maven/plugins/trunk/maven-javadoc-plugin/src/test/resources/unit/aggregate-test/aggregate-test-plugin-config.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/test/resources/unit/aggregate-test/aggregate-test-plugin-config.xml?rev=1752018&r1=1752017&r2=1752018&view=diff
==============================================================================
--- maven/plugins/trunk/maven-javadoc-plugin/src/test/resources/unit/aggregate-test/aggregate-test-plugin-config.xml (original)
+++ maven/plugins/trunk/maven-javadoc-plugin/src/test/resources/unit/aggregate-test/aggregate-test-plugin-config.xml Sat Jul  9 16:35:25 2016
@@ -67,7 +67,6 @@ under the License.
             <project implementation="org.apache.maven.plugin.javadoc.stubs.AggregateProject1TestMavenProjectStub"/>
             <project implementation="org.apache.maven.plugin.javadoc.stubs.AggregateProject2TestMavenProjectStub"/>
           </reactorProjects>
-          <aggregate>true</aggregate>
           <javadocDirectory>${basedir}/src/test/resources/unit/aggregate-test/src/main/javadoc</javadocDirectory>
           <debug>true</debug>
           <failOnError>true</failOnError>