From b9dc38741887a8daea1f894741c2070c58901752 Mon Sep 17 00:00:00 2001
From: Mikolaj Izdebski <mizdebsk@redhat.com>
Date: Thu, 16 Apr 2015 10:18:25 +0200
Subject: [PATCH 1/4] Disable doclint in javadoc:aggregate MOJO executions
Java 8 detection code assumes that toolchains are not in use -- the
same JDK version is used to run XMvn and generate javadocs.
---
.../aether/XMvnMojoExecutionListener.java | 34 +++++++++++++++++++++-
1 file changed, 33 insertions(+), 1 deletion(-)
diff --git a/xmvn-connector-aether/src/main/java/org/fedoraproject/xmvn/connector/aether/XMvnMojoExecutionListener.java b/xmvn-connector-aether/src/main/java/org/fedoraproject/xmvn/connector/aether/XMvnMojoExecutionListener.java
index a9cac0e..e6b3e36 100644
--- a/xmvn-connector-aether/src/main/java/org/fedoraproject/xmvn/connector/aether/XMvnMojoExecutionListener.java
+++ b/xmvn-connector-aether/src/main/java/org/fedoraproject/xmvn/connector/aether/XMvnMojoExecutionListener.java
@@ -33,6 +33,8 @@ import org.apache.maven.plugin.Mojo;
import org.apache.maven.plugin.MojoExecution;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.project.MavenProject;
+import org.eclipse.sisu.bean.BeanProperties;
+import org.eclipse.sisu.bean.BeanProperty;
/**
* Listens to various MOJO executions and captures useful information.
@@ -44,6 +46,25 @@ import org.apache.maven.project.MavenProject;
public class XMvnMojoExecutionListener
implements MojoExecutionListener
{
+ private static final boolean IS_JAVA8_OR_LATER;
+
+ static
+ {
+ boolean isJava8;
+
+ try
+ {
+ Class.forName( "java.lang.reflect.Executable" );
+ isJava8 = true;
+ }
+ catch ( Throwable t )
+ {
+ isJava8 = false;
+ }
+
+ IS_JAVA8_OR_LATER = isJava8;
+ }
+
private static class MojoGoal
{
private final String groupId;
@@ -191,7 +212,18 @@ public class XMvnMojoExecutionListener
@Override
public void beforeMojoExecution( MojoExecutionEvent event )
{
- // Nothing to do
+ Mojo mojo = event.getMojo();
+ MojoExecution execution = event.getExecution();
+
+ // Disable doclint on Java 8+
+ if ( IS_JAVA8_OR_LATER && JAVADOC_AGGREGATE.equals( execution ) )
+ {
+ for ( BeanProperty<Object> property : new BeanProperties( mojo.getClass() ) )
+ {
+ if ( property.getName().equals( "additionalparam" ) )
+ property.set( mojo, "-Xdoclint:none" );
+ }
+ }
}
@Override
--
2.5.0