[MPLUGIN-190@ added @executionStrategy support and deprecated @attainAlways

git-svn-id: https://svn.apache.org/repos/asf/maven/plugin-tools/trunk@1215517 13f79535-47bb-0310-9956-ffa450edef68
master
Herve Boutemy 2011-12-17 16:03:52 +00:00
parent ec993bc2de
commit da4f1a1bf7
4 changed files with 20 additions and 1 deletions

View File

@ -160,6 +160,7 @@ public interface JavaMojoAnnotation
* Refer to <code>&#64;attainAlways</code>.
* <br/>
* <b>Note</b>: Should be defined in a Mojo Type.
* @deprecated use <code>&#64executionStrategy always</code> instead
*/
String MULTI_EXECUTION_STRATEGY = "attainAlways";

View File

@ -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 );

View File

@ -155,6 +155,14 @@ public class JavaMojoDescriptorExtractorTest
return descriptor.getMojos();
}
public void testShouldFindTwoMojoDescriptorsInTestSourceDirectory()
throws Exception
{
List<MojoDescriptor> results = extract( "source" );
assertEquals( "Extracted mojos", 2, results.size() );
}
public void testShouldPropagateImplementationParameter()
throws Exception
{

View File

@ -76,7 +76,7 @@
<language>java</language>
<configurator>&quot;role-hint&quot;</configurator>
<instantiationStrategy>singleton</instantiationStrategy>
<executionStrategy>once-per-session</executionStrategy>
<executionStrategy>always</executionStrategy>
<deprecated>deprecation text test</deprecated>
<requiresDependencyCollection>test</requiresDependencyCollection>
<threadSafe>true</threadSafe>