svn commit: r1815019 - in /maven/plugins/trunk/maven-javadoc-plugin/src: it/projects/additional-dependencies-non-aggregate/ it/projects/additional-dependencies/ main/java/org/apache/maven/plugins/javadoc/ test/java/org/apache/maven/plugins/javadoc/

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r1815019 - in /maven/plugins/trunk/maven-javadoc-plugin/src: it/projects/additional-dependencies-non-aggregate/ it/projects/additional-dependencies/ main/java/org/apache/maven/plugins/javadoc/ test/java/org/apache/maven/plugins/javadoc/

rfscholte
Author: rfscholte
Date: Sun Nov 12 14:05:05 2017
New Revision: 1815019

URL: http://svn.apache.org/viewvc?rev=1815019&view=rev
Log:
[MJAVADOC-475] Replace parameter additionalparam with additionalOptions

Modified:
    maven/plugins/trunk/maven-javadoc-plugin/src/it/projects/additional-dependencies-non-aggregate/pom.xml
    maven/plugins/trunk/maven-javadoc-plugin/src/it/projects/additional-dependencies/pom.xml
    maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java
    maven/plugins/trunk/maven-javadoc-plugin/src/test/java/org/apache/maven/plugins/javadoc/AggregatorJavadocReportTest.java
    maven/plugins/trunk/maven-javadoc-plugin/src/test/java/org/apache/maven/plugins/javadoc/JavadocJarTest.java
    maven/plugins/trunk/maven-javadoc-plugin/src/test/java/org/apache/maven/plugins/javadoc/JavadocReportTest.java
    maven/plugins/trunk/maven-javadoc-plugin/src/test/java/org/apache/maven/plugins/javadoc/TestJavadocReportTest.java

Modified: maven/plugins/trunk/maven-javadoc-plugin/src/it/projects/additional-dependencies-non-aggregate/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/it/projects/additional-dependencies-non-aggregate/pom.xml?rev=1815019&r1=1815018&r2=1815019&view=diff
==============================================================================
--- maven/plugins/trunk/maven-javadoc-plugin/src/it/projects/additional-dependencies-non-aggregate/pom.xml (original)
+++ maven/plugins/trunk/maven-javadoc-plugin/src/it/projects/additional-dependencies-non-aggregate/pom.xml Sun Nov 12 14:05:05 2017
@@ -108,7 +108,16 @@
               -federationxml JDK http://doclava.googlecode.com/svn/static/api/openjdk-6.xml -->
              -hdf project.name "${project.name}"
              -d ${project.build.directory}/site/apidocs
-           </additionalparam>
+          </additionalparam>
+          <additionalOptions>
+            <additionalOption>
+              <!-- comment as produce an NPE
+               -federate JDK http://docs.oracle.com/javase/6/docs/api/index.html?
+                -federationxml JDK http://doclava.googlecode.com/svn/static/api/openjdk-6.xml -->
+               -hdf project.name "${project.name}"
+               -d ${project.build.directory}/site/apidocs
+            </additionalOption>
+          </additionalOptions>
           <useStandardDocletOptions>false</useStandardDocletOptions>
           <!--
             | Apple's JVM sometimes requires more memory

Modified: maven/plugins/trunk/maven-javadoc-plugin/src/it/projects/additional-dependencies/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/it/projects/additional-dependencies/pom.xml?rev=1815019&r1=1815018&r2=1815019&view=diff
==============================================================================
--- maven/plugins/trunk/maven-javadoc-plugin/src/it/projects/additional-dependencies/pom.xml (original)
+++ maven/plugins/trunk/maven-javadoc-plugin/src/it/projects/additional-dependencies/pom.xml Sun Nov 12 14:05:05 2017
@@ -102,13 +102,15 @@
             | bootclasspath required by Sun's JVM
           -->
           <bootclasspath>${sun.boot.class.path}</bootclasspath>
-          <additionalparam>
-            <!-- comment as produce an NPE
-             -federate JDK http://docs.oracle.com/javase/6/docs/api/index.html?
-              -federationxml JDK http://doclava.googlecode.com/svn/static/api/openjdk-6.xml -->
-             -hdf project.name "${project.name}"
-             -d ${project.build.directory}/site/apidocs
-           </additionalparam>
+          <additionalOptions>
+            <additionalOption>
+              <!-- comment as produce an NPE
+               -federate JDK http://docs.oracle.com/javase/6/docs/api/index.html?
+                -federationxml JDK http://doclava.googlecode.com/svn/static/api/openjdk-6.xml -->
+               -hdf project.name "${project.name}"
+               -d ${project.build.directory}/site/apidocs
+             </additionalOption>
+          </additionalOptions>
           <useStandardDocletOptions>false</useStandardDocletOptions>
           <!--
             | Apple's JVM sometimes requires more memory

Modified: maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java?rev=1815019&r1=1815018&r2=1815019&view=diff
==============================================================================
--- maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java (original)
+++ maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java Sun Nov 12 14:05:05 2017
@@ -71,9 +71,9 @@ import org.apache.maven.model.Dependency
 import org.apache.maven.model.Plugin;
 import org.apache.maven.model.Resource;
 import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecution;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugin.MojoFailureException;
-import org.apache.maven.plugin.descriptor.PluginDescriptor;
 import org.apache.maven.plugins.annotations.Component;
 import org.apache.maven.plugins.annotations.Parameter;
 import org.apache.maven.plugins.javadoc.options.BootclasspathArtifact;
@@ -358,8 +358,8 @@ public abstract class AbstractJavadocMoj
     @Parameter( defaultValue = "${project}", readonly = true, required = true )
     protected MavenProject project;
 
-    @Parameter( defaultValue = "${plugin}", readonly = true )
-    private PluginDescriptor plugin;
+    @Parameter( defaultValue = "${mojoExecution}", readonly = true )
+    private MojoExecution mojo;
 
     /**
      * Specify if the Javadoc should operate in offline mode.
@@ -381,14 +381,13 @@ public abstract class AbstractJavadocMoj
     private File javadocDirectory;
 
     /**
-     * Set an additional parameter(s) on the command line. This value should include quotes as necessary for
+     * Set an additional option(s) on the command line. This value should include quotes as necessary for
      * parameters that include spaces. Useful for a custom doclet.
-     *
-     * @deprecated Does not properly support multiple options at once and has a bad name
+     *
+     * @since 3.0.0
      */
-    @Parameter( property = "additionalparam" )
-    @Deprecated
-    private String additionalparam;
+    @Parameter
+    private String[] additionalOptions;
 
     /**
      * Set an additional Javadoc option(s) (i.e. JVM options) on the command line.
@@ -1890,15 +1889,16 @@ public abstract class AbstractJavadocMoj
         verifyRemovedParameter( "aggregator" );
         verifyRemovedParameter( "proxyHost" );
         verifyRemovedParameter( "proxyPort" );
+        verifyReplacedParameter( "additionalparam", "additionalOptions" );
 
         doExecute();
     }
 
     abstract void doExecute() throws MojoExecutionException, MojoFailureException;
 
-    private void verifyRemovedParameter( String paramName )
+    protected final void verifyRemovedParameter( String paramName )
     {
-        Object pluginConfiguration = plugin.getPlugin().getConfiguration();
+        Object pluginConfiguration = mojo.getConfiguration();
         if ( pluginConfiguration instanceof Xpp3Dom )
         {
             Xpp3Dom configDom = (Xpp3Dom) pluginConfiguration;
@@ -1911,6 +1911,21 @@ public abstract class AbstractJavadocMoj
         }
     }
 
+    private void verifyReplacedParameter( String oldParamName, String newParamNew )
+    {
+        Object pluginConfiguration = mojo.getConfiguration();
+        if ( pluginConfiguration instanceof Xpp3Dom )
+        {
+            Xpp3Dom configDom = (Xpp3Dom) pluginConfiguration;
+
+            if ( configDom.getChild( oldParamName ) != null )
+            {
+                throw new IllegalArgumentException( "parameter '" + oldParamName
+                    + "' has been replaced with " + newParamNew + ", please verify documentation." );
+            }
+        }
+    }
+
     /**
      * The <a href="package-summary.html">package documentation</a> details the
      * Javadoc Options used by this Plugin.
@@ -4663,7 +4678,13 @@ public abstract class AbstractJavadocMoj
 
         addArgIf( arguments, verbose, "-verbose" );
 
-        addArgIfNotEmpty( arguments, null, additionalparam );
+        if ( additionalOptions != null && additionalOptions.length > 0 )
+        {
+            for ( String option : additionalOptions )
+            {
+                arguments.add( option );
+            }
+        }
     }
 
     /**

Modified: maven/plugins/trunk/maven-javadoc-plugin/src/test/java/org/apache/maven/plugins/javadoc/AggregatorJavadocReportTest.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/test/java/org/apache/maven/plugins/javadoc/AggregatorJavadocReportTest.java?rev=1815019&r1=1815018&r2=1815019&view=diff
==============================================================================
--- maven/plugins/trunk/maven-javadoc-plugin/src/test/java/org/apache/maven/plugins/javadoc/AggregatorJavadocReportTest.java (original)
+++ maven/plugins/trunk/maven-javadoc-plugin/src/test/java/org/apache/maven/plugins/javadoc/AggregatorJavadocReportTest.java Sun Nov 12 14:05:05 2017
@@ -1,7 +1,5 @@
 package org.apache.maven.plugins.javadoc;
 
-import java.io.BufferedReader;
-
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -21,13 +19,14 @@ import java.io.BufferedReader;
  * under the License.
  */
 
+import java.io.BufferedReader;
 import java.io.File;
 import java.io.FileReader;
 import java.io.IOException;
 import java.util.List;
 
 import org.apache.maven.model.Plugin;
-import org.apache.maven.plugin.descriptor.PluginDescriptor;
+import org.apache.maven.plugin.MojoExecution;
 import org.apache.maven.plugin.testing.AbstractMojoTestCase;
 import org.apache.maven.plugins.javadoc.JavadocReport;
 import org.codehaus.plexus.util.FileUtils;
@@ -63,10 +62,10 @@ public class AggregatorJavadocReportTest
     {
         JavadocReport mojo = (JavadocReport) lookupMojo( "aggregate", testPom );
 
-        PluginDescriptor pluginDescriptor = new PluginDescriptor();
-        pluginDescriptor.setPlugin( new Plugin() );
+        MojoExecution mojoExec = new MojoExecution( new Plugin(), "aggregate", null );
+
+        setVariableValueToObject( mojo, "mojo", mojoExec );
 
-        setVariableValueToObject( mojo, "plugin", pluginDescriptor );
         return mojo;
     }
 

Modified: maven/plugins/trunk/maven-javadoc-plugin/src/test/java/org/apache/maven/plugins/javadoc/JavadocJarTest.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/test/java/org/apache/maven/plugins/javadoc/JavadocJarTest.java?rev=1815019&r1=1815018&r2=1815019&view=diff
==============================================================================
--- maven/plugins/trunk/maven-javadoc-plugin/src/test/java/org/apache/maven/plugins/javadoc/JavadocJarTest.java (original)
+++ maven/plugins/trunk/maven-javadoc-plugin/src/test/java/org/apache/maven/plugins/javadoc/JavadocJarTest.java Sun Nov 12 14:05:05 2017
@@ -30,7 +30,7 @@ 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.MojoExecution;
 import org.apache.maven.plugin.testing.AbstractMojoTestCase;
 import org.apache.maven.plugins.javadoc.AbstractJavadocMojo;
 import org.apache.maven.plugins.javadoc.JavadocJar;
@@ -48,11 +48,11 @@ public class JavadocJarTest
                     throws Exception
     {
         JavadocJar mojo = (JavadocJar) lookupMojo( "jar", testPom );
+
+        MojoExecution mojoExec = new MojoExecution( new Plugin(), "javadoc", null );
+
+        setVariableValueToObject( mojo, "mojo", mojoExec );
         
-        PluginDescriptor pluginDescriptor = new PluginDescriptor();
-        pluginDescriptor.setPlugin( new Plugin() );
-        
-        setVariableValueToObject( mojo, "plugin", pluginDescriptor );
         return mojo;
     }
 
@@ -179,7 +179,7 @@ public class JavadocJarTest
         }
         jar.close();
 
-        List<String> expected = new ArrayList();
+        List<String> expected = new ArrayList<>();
         expected.add( "META-INF/" );
         expected.add( "META-INF/maven/" );
         expected.add( "META-INF/maven/org.apache.maven.plugins.maven-javadoc-plugin.unit/" );

Modified: maven/plugins/trunk/maven-javadoc-plugin/src/test/java/org/apache/maven/plugins/javadoc/JavadocReportTest.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/test/java/org/apache/maven/plugins/javadoc/JavadocReportTest.java?rev=1815019&r1=1815018&r2=1815019&view=diff
==============================================================================
--- maven/plugins/trunk/maven-javadoc-plugin/src/test/java/org/apache/maven/plugins/javadoc/JavadocReportTest.java (original)
+++ maven/plugins/trunk/maven-javadoc-plugin/src/test/java/org/apache/maven/plugins/javadoc/JavadocReportTest.java Sun Nov 12 14:05:05 2017
@@ -35,8 +35,8 @@ import org.apache.commons.lang3.SystemUt
 import org.apache.maven.execution.MavenSession;
 import org.apache.maven.model.Plugin;
 import org.apache.maven.plugin.LegacySupport;
+import org.apache.maven.plugin.MojoExecution;
 import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.plugin.descriptor.PluginDescriptor;
 import org.apache.maven.plugin.testing.AbstractMojoTestCase;
 import org.apache.maven.plugins.javadoc.JavadocReport;
 import org.apache.maven.plugins.javadoc.JavadocVersion;
@@ -89,10 +89,10 @@ public class JavadocReportTest
     {
         JavadocReport mojo = (JavadocReport) lookupMojo( "javadoc", testPom );
 
-        PluginDescriptor pluginDescriptor = new PluginDescriptor();
-        pluginDescriptor.setPlugin( new Plugin() );
-        
-        setVariableValueToObject( mojo, "plugin", pluginDescriptor );
+        MojoExecution mojoExec = new MojoExecution( new Plugin(), "javadoc", null );
+
+        setVariableValueToObject( mojo, "mojo", mojoExec );
+
         return mojo;
     }
 

Modified: maven/plugins/trunk/maven-javadoc-plugin/src/test/java/org/apache/maven/plugins/javadoc/TestJavadocReportTest.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/test/java/org/apache/maven/plugins/javadoc/TestJavadocReportTest.java?rev=1815019&r1=1815018&r2=1815019&view=diff
==============================================================================
--- maven/plugins/trunk/maven-javadoc-plugin/src/test/java/org/apache/maven/plugins/javadoc/TestJavadocReportTest.java (original)
+++ maven/plugins/trunk/maven-javadoc-plugin/src/test/java/org/apache/maven/plugins/javadoc/TestJavadocReportTest.java Sun Nov 12 14:05:05 2017
@@ -22,7 +22,7 @@ package org.apache.maven.plugins.javadoc
 import java.io.File;
 
 import org.apache.maven.model.Plugin;
-import org.apache.maven.plugin.descriptor.PluginDescriptor;
+import org.apache.maven.plugin.MojoExecution;
 import org.apache.maven.plugin.testing.AbstractMojoTestCase;
 import org.apache.maven.plugins.javadoc.TestJavadocReport;
 import org.codehaus.plexus.util.FileUtils;
@@ -46,10 +46,9 @@ public class TestJavadocReportTest
                       "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 );
+        MojoExecution mojoExec = new MojoExecution( new Plugin(), "test-javadoc", null );
+
+        setVariableValueToObject( mojo, "mojo", mojoExec );
         
         mojo.execute();