diff --git a/maven-plugin-tools-java/src/main/java/org/apache/maven/tools/plugin/extractor/java/JavaMojoAnnotation.java b/maven-plugin-tools-java/src/main/java/org/apache/maven/tools/plugin/extractor/java/JavaMojoAnnotation.java
index 653a2ca..1463e4b 100644
--- a/maven-plugin-tools-java/src/main/java/org/apache/maven/tools/plugin/extractor/java/JavaMojoAnnotation.java
+++ b/maven-plugin-tools-java/src/main/java/org/apache/maven/tools/plugin/extractor/java/JavaMojoAnnotation.java
@@ -160,6 +160,7 @@ public interface JavaMojoAnnotation
* Refer to @attainAlways.
*
* Note: Should be defined in a Mojo Type.
+ * @deprecated use @executionStrategy always instead
*/
String MULTI_EXECUTION_STRATEGY = "attainAlways";
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 b3280be..ce69597 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
@@ -271,15 +271,25 @@ public class JavaMojoDescriptorExtractor
{
mojoDescriptor.setInstantiationStrategy( tag.getValue() );
}
+
+ // executionStrategy (and deprecated @attainAlways)
tag = findInClassHierarchy( javaClass, JavaMojoAnnotation.MULTI_EXECUTION_STRATEGY );
if ( tag != null )
{
+ getLogger().warn( "@" + JavaMojoAnnotation.MULTI_EXECUTION_STRATEGY + " in "
+ + javaClass.getFullyQualifiedName() + " is deprecated: please use '@"
+ + JavaMojoAnnotation.EXECUTION_STATEGY + " always' instead.");
mojoDescriptor.setExecutionStrategy( MojoDescriptor.MULTI_PASS_EXEC_STRATEGY );
}
else
{
mojoDescriptor.setExecutionStrategy( MojoDescriptor.SINGLE_PASS_EXEC_STRATEGY );
}
+ tag = findInClassHierarchy( javaClass, JavaMojoAnnotation.EXECUTION_STATEGY );
+ if ( tag != null )
+ {
+ mojoDescriptor.setExecutionStrategy( tag.getValue() );
+ }
// Phase name
DocletTag phase = findInClassHierarchy( javaClass, JavaMojoAnnotation.PHASE );
diff --git a/maven-plugin-tools-java/src/test/java/org/apache/maven/tools/plugin/extractor/java/JavaMojoDescriptorExtractorTest.java b/maven-plugin-tools-java/src/test/java/org/apache/maven/tools/plugin/extractor/java/JavaMojoDescriptorExtractorTest.java
index 20a17f0..c6e18b5 100644
--- a/maven-plugin-tools-java/src/test/java/org/apache/maven/tools/plugin/extractor/java/JavaMojoDescriptorExtractorTest.java
+++ b/maven-plugin-tools-java/src/test/java/org/apache/maven/tools/plugin/extractor/java/JavaMojoDescriptorExtractorTest.java
@@ -155,6 +155,14 @@ public class JavaMojoDescriptorExtractorTest
return descriptor.getMojos();
}
+ public void testShouldFindTwoMojoDescriptorsInTestSourceDirectory()
+ throws Exception
+ {
+ List results = extract( "source" );
+
+ assertEquals( "Extracted mojos", 2, results.size() );
+ }
+
public void testShouldPropagateImplementationParameter()
throws Exception
{
diff --git a/maven-plugin-tools-java/src/test/resources/source/plugin-expected.xml b/maven-plugin-tools-java/src/test/resources/source/plugin-expected.xml
index 6ed507d..258f7e2 100644
--- a/maven-plugin-tools-java/src/test/resources/source/plugin-expected.xml
+++ b/maven-plugin-tools-java/src/test/resources/source/plugin-expected.xml
@@ -76,7 +76,7 @@
java
"role-hint"
singleton
- once-per-session
+ always
deprecation text test
test
true