You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by mi...@apache.org on 2016/10/15 17:37:33 UTC
svn commit: r1765097 -
/maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/AbstractJavadocMojo.java
Author: michaelo
Date: Sat Oct 15 17:37:33 2016
New Revision: 1765097
URL: http://svn.apache.org/viewvc?rev=1765097&view=rev
Log:
[MJAVADOC-387] Handle JDK8 -Xdoclint
Add proper handling of -Xdoclint. Option is only evaluated if Java 1.8+ is used otherwise a warning is issued.
Due to a limitation in Modello, it cannot simply enabled by <doclint /> because it is umarshaled to null instead of "". One has to use <doclint>all</doclint> explicitly.
Modified:
maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/AbstractJavadocMojo.java
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=1765097&r1=1765096&r2=1765097&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 Oct 15 17:37:33 2016
@@ -279,6 +279,15 @@ public abstract class AbstractJavadocMoj
*/
private static final float SINCE_JAVADOC_1_6 = 1.6f;
+ /**
+ * For Javadoc options appears since Java 8.0.
+ * See <a href="http://docs.oracle.com/javase/8/docs/technotes/guides/javadoc/index.html">
+ * Javadoc Technology</a>
+ *
+ * @since 3.0.0
+ */
+ private static final float SINCE_JAVADOC_1_8 = 1.8f;
+
// ----------------------------------------------------------------------
// Mojo components
// ----------------------------------------------------------------------
@@ -310,16 +319,16 @@ public abstract class AbstractJavadocMoj
*/
@Component
private ArtifactResolver resolver;
-
+
@Component
private ResourceResolver resourceResolver;
-
+
@Component
private org.apache.maven.shared.artifact.resolve.ArtifactResolver artifactResolver;
-
+
@Component
private ArtifactHandlerManager artifactHandlerManager;
-
+
@Component
private DependencyResolver dependencyResolver;
@@ -359,7 +368,7 @@ public abstract class AbstractJavadocMoj
*/
@Parameter( defaultValue = "${project}", readonly = true, required = true )
protected MavenProject project;
-
+
@Parameter( defaultValue = "${plugin}", readonly = true )
private PluginDescriptor plugin;
@@ -966,6 +975,16 @@ public abstract class AbstractJavadocMoj
private boolean docfilessubdirs;
/**
+ * Specifies specific checks to be performed on Javadoc comments.
+ * <br/>
+ * See <a href="http://docs.oracle.com/javase/8/docs/technotes/tools/windows/javadoc.html#BEJEFABE">doclint</a>.
+ *
+ * @since 3.0.0
+ */
+ @Parameter( property = "doclint" )
+ private String doclint;
+
+ /**
* Specifies the title to be placed near the top of the overview summary file.
* <br/>
* See <a href="http://docs.oracle.com/javase/7/docs/technotes/tools/windows/javadoc.html#doctitle">doctitle</a>.
@@ -1827,6 +1846,14 @@ public abstract class AbstractJavadocMoj
}
/**
+ * @return the doclint specific checks configuration
+ */
+ protected String getDoclint()
+ {
+ return doclint;
+ }
+
+ /**
* @return the title to be placed near the top of the overview summary file
*/
protected String getDoctitle()
@@ -1881,19 +1908,19 @@ public abstract class AbstractJavadocMoj
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
@@ -1901,7 +1928,7 @@ public abstract class AbstractJavadocMoj
}
}
}
-
+
/**
* The <a href="package-summary.html">package documentation</a> details the
* Javadoc Options used by this Plugin.
@@ -2046,7 +2073,7 @@ public abstract class AbstractJavadocMoj
// ----------------------------------------------------------------------
// MJAVADOC-365 if includes/excludes are specified, these take precedence over the default
- // package-based mode and force javadoc into file-based mode unless subpackages are
+ // package-based mode and force javadoc into file-based mode unless subpackages are
// specified. Subpackages take precedence over file-based include/excludes. Why? Because
// getFiles(...) returns an empty list when subpackages are specified.
boolean includesExcludesActive =
@@ -2366,7 +2393,7 @@ public abstract class AbstractJavadocMoj
*/
private SourceResolverConfig getDependencySourceResolverConfig()
{
- return configureDependencySourceResolution(
+ return configureDependencySourceResolution(
new SourceResolverConfig( project, localRepository,
sourceDependencyCacheDir ).withReactorProjects( reactorProjects ) );
}
@@ -2656,7 +2683,7 @@ public abstract class AbstractJavadocMoj
coordinate.setVersion( dependency.getVersion() );
coordinate.setClassifier( dependency.getClassifier() );
coordinate.setExtension( artifactHandlerManager.getArtifactHandler( dependency.getType() ).getExtension() );
-
+
try
{
return artifactResolver.resolveArtifact( session.getProjectBuildingRequest(), coordinate ).getArtifact();
@@ -3452,7 +3479,7 @@ public abstract class AbstractJavadocMoj
*
* @param javadocArtifact the {@link JavadocPathArtifact} to resolve
* @return a resolved {@link Artifact}
- * @throws ArtifactResolverException
+ * @throws ArtifactResolverException
*/
private Artifact createAndResolveArtifact( JavadocPathArtifact javadocArtifact )
throws ArtifactResolverException
@@ -4718,6 +4745,8 @@ public abstract class AbstractJavadocMoj
addArgIf( arguments, docfilessubdirs, "-docfilessubdirs", SINCE_JAVADOC_1_4 );
+ addArgIf( arguments, StringUtils.isNotEmpty( doclint ), "-Xdoclint:" + getDoclint(), SINCE_JAVADOC_1_8 );
+
addArgIfNotEmpty( arguments, "-doctitle", JavadocUtil.quotedArgument( getDoctitle() ), false, false );
if ( docfilessubdirs )