69 lines
3.0 KiB
Diff
69 lines
3.0 KiB
Diff
From 0ebe12503766c6a76c507498e9e7f0cb1c4469c2 Mon Sep 17 00:00:00 2001
|
|
From: Michael Simacek <msimacek@redhat.com>
|
|
Date: Mon, 16 Mar 2015 14:29:21 +0100
|
|
Subject: [PATCH 1/3] Avoid duplicate MOJO parameters
|
|
|
|
---
|
|
.../JavaAnnotationsMojoDescriptorExtractor.java | 24 ++++++++++++++++++++--
|
|
1 file changed, 22 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/extractor/annotations/JavaAnnotationsMojoDescriptorExtractor.java b/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/extractor/annotations/JavaAnnotationsMojoDescriptorExtractor.java
|
|
index 587ddad..231ed12 100644
|
|
--- a/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/extractor/annotations/JavaAnnotationsMojoDescriptorExtractor.java
|
|
+++ b/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/extractor/annotations/JavaAnnotationsMojoDescriptorExtractor.java
|
|
@@ -29,6 +29,7 @@ import java.util.Collection;
|
|
import java.util.Collections;
|
|
import java.util.HashMap;
|
|
import java.util.HashSet;
|
|
+import java.util.Iterator;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.Set;
|
|
@@ -573,7 +574,7 @@ public class JavaAnnotationsMojoDescriptorExtractor
|
|
parameter.setSince( parameterAnnotationContent.getSince() );
|
|
parameter.setRequired( parameterAnnotationContent.required() );
|
|
|
|
- mojoDescriptor.addParameter( parameter );
|
|
+ addParameter( mojoDescriptor, parameter );
|
|
}
|
|
|
|
// Component annotations
|
|
@@ -614,7 +615,7 @@ public class JavaAnnotationsMojoDescriptorExtractor
|
|
//parameter.setRequired( ... );
|
|
parameter.setEditable( false );
|
|
|
|
- mojoDescriptor.addParameter( parameter );
|
|
+ addParameter( mojoDescriptor, parameter );
|
|
}
|
|
|
|
mojoDescriptor.setPluginDescriptor( pluginDescriptor );
|
|
@@ -624,6 +625,25 @@ public class JavaAnnotationsMojoDescriptorExtractor
|
|
return mojoDescriptors;
|
|
}
|
|
|
|
+ private void addParameter( ExtendedMojoDescriptor mojoDescriptor,
|
|
+ org.apache.maven.plugin.descriptor.Parameter parameter )
|
|
+ throws DuplicateParameterException
|
|
+ {
|
|
+ if ( mojoDescriptor.getParameters() != null )
|
|
+ {
|
|
+ for ( Iterator<?> it = mojoDescriptor.getParameters().iterator(); it.hasNext(); )
|
|
+ {
|
|
+ if ( it.next().equals( parameter ) )
|
|
+ {
|
|
+ getLogger().warn( "Duplicate parameter " + parameter.getName() + " field in MOJO descriptor" );
|
|
+ it.remove();
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+
|
|
+ mojoDescriptor.addParameter( parameter );
|
|
+ }
|
|
+
|
|
protected ExecuteAnnotationContent findExecuteInParentHierarchy( MojoAnnotatedClass mojoAnnotatedClass,
|
|
Map<String, MojoAnnotatedClass> mojoAnnotatedClasses )
|
|
{
|
|
--
|
|
2.14.3
|
|
|