Port to QDox 2.0
This commit is contained in:
parent
c1e815334c
commit
d485041def
@ -1,7 +1,7 @@
|
||||
From d72e785c46305fe00eb126d315d2dfe4b98f458a Mon Sep 17 00:00:00 2001
|
||||
From: Mikolaj Izdebski <mizdebsk@redhat.com>
|
||||
Date: Mon, 13 Oct 2014 11:50:26 +0200
|
||||
Subject: [PATCH] Avoid duplicate MOJO parameters
|
||||
Subject: [PATCH 1/2] Avoid duplicate MOJO parameters
|
||||
|
||||
---
|
||||
.../JavaAnnotationsMojoDescriptorExtractor.java | 24 ++++++++++++++++++++--
|
||||
|
||||
176
0002-Port-to-QDox-2.0.patch
Normal file
176
0002-Port-to-QDox-2.0.patch
Normal file
@ -0,0 +1,176 @@
|
||||
From 1e6ca46d86b2e63b5444368d900b675919852c3f Mon Sep 17 00:00:00 2001
|
||||
From: Mikolaj Izdebski <mizdebsk@redhat.com>
|
||||
Date: Tue, 28 Oct 2014 10:34:51 +0100
|
||||
Subject: [PATCH 2/2] Port to QDox 2.0
|
||||
|
||||
---
|
||||
.../JavaAnnotationsMojoDescriptorExtractor.java | 15 ++++++++-------
|
||||
.../extractor/java/JavaMojoDescriptorExtractor.java | 18 +++++++++---------
|
||||
pom.xml | 2 +-
|
||||
3 files changed, 18 insertions(+), 17 deletions(-)
|
||||
|
||||
diff --git a/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/JavaAnnotationsMojoDescriptorExtractor.java b/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/JavaAnnotationsMojoDescriptorExtractor.java
|
||||
index ed3a17f..41a47d0 100644
|
||||
--- a/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/JavaAnnotationsMojoDescriptorExtractor.java
|
||||
+++ b/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/JavaAnnotationsMojoDescriptorExtractor.java
|
||||
@@ -19,10 +19,11 @@ package org.apache.maven.tools.plugin.annotations;
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
-import com.thoughtworks.qdox.JavaDocBuilder;
|
||||
+import com.thoughtworks.qdox.JavaProjectBuilder;
|
||||
import com.thoughtworks.qdox.model.DocletTag;
|
||||
import com.thoughtworks.qdox.model.JavaClass;
|
||||
import com.thoughtworks.qdox.model.JavaField;
|
||||
+
|
||||
import org.apache.maven.artifact.Artifact;
|
||||
import org.apache.maven.artifact.factory.ArtifactFactory;
|
||||
import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
|
||||
@@ -377,7 +378,7 @@ public class JavaAnnotationsMojoDescriptorExtractor
|
||||
|
||||
if ( superClass != null )
|
||||
{
|
||||
- if ( superClass.getFields().length > 0 )
|
||||
+ if ( superClass.getFields().size() > 0 )
|
||||
{
|
||||
rawParams = extractFieldParameterTags( superClass, javaClassesMap );
|
||||
}
|
||||
@@ -394,7 +395,7 @@ public class JavaAnnotationsMojoDescriptorExtractor
|
||||
rawParams = new TreeMap<String, JavaField>();
|
||||
}
|
||||
|
||||
- JavaField[] classFields = javaClass.getFields();
|
||||
+ Collection<JavaField> classFields = javaClass.getFields();
|
||||
|
||||
if ( classFields != null )
|
||||
{
|
||||
@@ -434,7 +435,7 @@ public class JavaAnnotationsMojoDescriptorExtractor
|
||||
|
||||
protected Map<String, JavaClass> discoverClasses( final String encoding, List<File> sourceDirectories )
|
||||
{
|
||||
- JavaDocBuilder builder = new JavaDocBuilder();
|
||||
+ JavaProjectBuilder builder = new JavaProjectBuilder();
|
||||
builder.setEncoding( encoding );
|
||||
|
||||
for ( File source : sourceDirectories )
|
||||
@@ -442,14 +443,14 @@ public class JavaAnnotationsMojoDescriptorExtractor
|
||||
builder.addSourceTree( source );
|
||||
}
|
||||
|
||||
- JavaClass[] javaClasses = builder.getClasses();
|
||||
+ Collection<JavaClass> javaClasses = builder.getClasses();
|
||||
|
||||
- if ( javaClasses == null || javaClasses.length < 1 )
|
||||
+ if ( javaClasses == null || javaClasses.size() < 1 )
|
||||
{
|
||||
return Collections.emptyMap();
|
||||
}
|
||||
|
||||
- Map<String, JavaClass> javaClassMap = new HashMap<String, JavaClass>( javaClasses.length );
|
||||
+ Map<String, JavaClass> javaClassMap = new HashMap<String, JavaClass>( javaClasses.size() );
|
||||
|
||||
for ( JavaClass javaClass : javaClasses )
|
||||
{
|
||||
diff --git a/maven-plugin-tools-java/src/main/java/org/apache/maven/tools/plugin/extractor/java/JavaMojoDescriptorExtractor.java b/maven-plugin-tools-java/src/main/java/org/apache/maven/tools/plugin/extractor/java/JavaMojoDescriptorExtractor.java
|
||||
index 3fabe44..dbbe480 100644
|
||||
--- a/maven-plugin-tools-java/src/main/java/org/apache/maven/tools/plugin/extractor/java/JavaMojoDescriptorExtractor.java
|
||||
+++ b/maven-plugin-tools-java/src/main/java/org/apache/maven/tools/plugin/extractor/java/JavaMojoDescriptorExtractor.java
|
||||
@@ -19,11 +19,10 @@ package org.apache.maven.tools.plugin.extractor.java;
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
-import com.thoughtworks.qdox.JavaDocBuilder;
|
||||
+import com.thoughtworks.qdox.JavaProjectBuilder;
|
||||
import com.thoughtworks.qdox.model.DocletTag;
|
||||
import com.thoughtworks.qdox.model.JavaClass;
|
||||
import com.thoughtworks.qdox.model.JavaField;
|
||||
-import com.thoughtworks.qdox.model.Type;
|
||||
|
||||
import org.apache.maven.plugin.descriptor.InvalidParameterException;
|
||||
import org.apache.maven.plugin.descriptor.InvalidPluginDescriptorException;
|
||||
@@ -36,13 +35,13 @@ import org.apache.maven.tools.plugin.PluginToolsRequest;
|
||||
import org.apache.maven.tools.plugin.extractor.MojoDescriptorExtractor;
|
||||
import org.apache.maven.tools.plugin.extractor.ExtractionException;
|
||||
import org.apache.maven.tools.plugin.util.PluginUtils;
|
||||
-
|
||||
import org.codehaus.plexus.component.annotations.Component;
|
||||
import org.codehaus.plexus.logging.AbstractLogEnabled;
|
||||
import org.codehaus.plexus.util.StringUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
+import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
@@ -199,7 +198,7 @@ public class JavaMojoDescriptorExtractor
|
||||
ExtendedMojoDescriptor mojoDescriptor = new ExtendedMojoDescriptor();
|
||||
mojoDescriptor.setLanguage( "java" );
|
||||
mojoDescriptor.setImplementation( javaClass.getFullyQualifiedName() );
|
||||
- mojoDescriptor.setDescription( javaClass.getComment() );
|
||||
+ mojoDescriptor.setDescription( javaClass.getComment() != null ? javaClass.getComment() : "" );
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Mojo annotations in alphabetical order
|
||||
@@ -468,7 +467,7 @@ public class JavaMojoDescriptorExtractor
|
||||
{
|
||||
JavaField field = entry.getValue();
|
||||
|
||||
- Type type = field.getType();
|
||||
+ JavaClass type = field.getType();
|
||||
|
||||
Parameter pd = new Parameter();
|
||||
|
||||
@@ -492,7 +491,7 @@ public class JavaMojoDescriptorExtractor
|
||||
pd.setType( value.toString() );
|
||||
}
|
||||
|
||||
- pd.setDescription( field.getComment() );
|
||||
+ pd.setDescription( field.getComment() != null ? field.getComment() : "" );
|
||||
|
||||
DocletTag deprecationTag = field.getTagByName( JavaMojoAnnotation.DEPRECATED );
|
||||
|
||||
@@ -653,7 +652,7 @@ public class JavaMojoDescriptorExtractor
|
||||
rawParams = new TreeMap<String, JavaField>();
|
||||
}
|
||||
|
||||
- JavaField[] classFields = javaClass.getFields();
|
||||
+ List<JavaField> classFields = javaClass.getFields();
|
||||
|
||||
if ( classFields != null )
|
||||
{
|
||||
@@ -703,7 +702,7 @@ public class JavaMojoDescriptorExtractor
|
||||
@SuppressWarnings( "unchecked" )
|
||||
protected JavaClass[] discoverClasses( final PluginToolsRequest request )
|
||||
{
|
||||
- JavaDocBuilder builder = new JavaDocBuilder();
|
||||
+ JavaProjectBuilder builder = new JavaProjectBuilder();
|
||||
builder.setEncoding( request.getEncoding() );
|
||||
|
||||
MavenProject project = request.getProject();
|
||||
@@ -720,7 +719,8 @@ public class JavaMojoDescriptorExtractor
|
||||
builder.addSourceTree( generatedPlugin );
|
||||
}
|
||||
|
||||
- return builder.getClasses();
|
||||
+ Collection<JavaClass> classes = builder.getClasses();
|
||||
+ return classes.toArray( new JavaClass[classes.size()] );
|
||||
}
|
||||
|
||||
/**
|
||||
diff --git a/pom.xml b/pom.xml
|
||||
index 0af658b..4ce60d9 100644
|
||||
--- a/pom.xml
|
||||
+++ b/pom.xml
|
||||
@@ -222,7 +222,7 @@
|
||||
<dependency>
|
||||
<groupId>com.thoughtworks.qdox</groupId>
|
||||
<artifactId>qdox</artifactId>
|
||||
- <version>1.12.1</version>
|
||||
+ <version>2.0-M2</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
--
|
||||
1.9.3
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
Name: maven-plugin-tools
|
||||
Version: 3.3
|
||||
Release: 3%{?dist}
|
||||
Release: 4%{?dist}
|
||||
Epoch: 0
|
||||
Summary: Maven Plugin Tools
|
||||
License: ASL 2.0
|
||||
@ -10,10 +10,11 @@ BuildArch: noarch
|
||||
Source0: http://repo2.maven.org/maven2/org/apache/maven/plugin-tools/%{name}/%{version}/%{name}-%{version}-source-release.zip
|
||||
|
||||
Patch0: 0001-Avoid-duplicate-MOJO-parameters.patch
|
||||
Patch1: 0002-Port-to-QDox-2.0.patch
|
||||
|
||||
BuildRequires: maven-local
|
||||
BuildRequires: mvn(com.sun:tools)
|
||||
BuildRequires: mvn(com.thoughtworks.qdox:qdox)
|
||||
BuildRequires: mvn(com.thoughtworks.qdox:qdox) >= 2.0
|
||||
BuildRequires: mvn(net.sf.jtidy:jtidy)
|
||||
BuildRequires: mvn(org.apache.ant:ant)
|
||||
BuildRequires: mvn(org.apache.ant:ant-launcher)
|
||||
@ -169,6 +170,7 @@ API documentation for %{name}.
|
||||
%prep
|
||||
%setup -q
|
||||
%patch0 -p1
|
||||
%patch1 -p1
|
||||
|
||||
# For easier installation
|
||||
ln -s maven-script/maven-script-{ant,beanshell} .
|
||||
@ -258,6 +260,9 @@ ln -s maven-script/maven-script-{ant,beanshell} .
|
||||
|
||||
|
||||
%changelog
|
||||
* Tue Oct 28 2014 Mikolaj Izdebski <mizdebsk@redhat.com> - 0:3.3-4
|
||||
- Port to QDox 2.0
|
||||
|
||||
* Tue Oct 14 2014 Mikolaj Izdebski <mizdebsk@redhat.com> - 0:3.3-3
|
||||
- Remove legacy Obsoletes/Provides for maven2 plugin
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user