[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-ffa450edef68master
parent
ec993bc2de
commit
da4f1a1bf7
|
|
@ -160,6 +160,7 @@ public interface JavaMojoAnnotation
|
||||||
* Refer to <code>@attainAlways</code>.
|
* Refer to <code>@attainAlways</code>.
|
||||||
* <br/>
|
* <br/>
|
||||||
* <b>Note</b>: Should be defined in a Mojo Type.
|
* <b>Note</b>: Should be defined in a Mojo Type.
|
||||||
|
* @deprecated use <code>@executionStrategy always</code> instead
|
||||||
*/
|
*/
|
||||||
String MULTI_EXECUTION_STRATEGY = "attainAlways";
|
String MULTI_EXECUTION_STRATEGY = "attainAlways";
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -271,15 +271,25 @@ public class JavaMojoDescriptorExtractor
|
||||||
{
|
{
|
||||||
mojoDescriptor.setInstantiationStrategy( tag.getValue() );
|
mojoDescriptor.setInstantiationStrategy( tag.getValue() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// executionStrategy (and deprecated @attainAlways)
|
||||||
tag = findInClassHierarchy( javaClass, JavaMojoAnnotation.MULTI_EXECUTION_STRATEGY );
|
tag = findInClassHierarchy( javaClass, JavaMojoAnnotation.MULTI_EXECUTION_STRATEGY );
|
||||||
if ( tag != null )
|
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 );
|
mojoDescriptor.setExecutionStrategy( MojoDescriptor.MULTI_PASS_EXEC_STRATEGY );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mojoDescriptor.setExecutionStrategy( MojoDescriptor.SINGLE_PASS_EXEC_STRATEGY );
|
mojoDescriptor.setExecutionStrategy( MojoDescriptor.SINGLE_PASS_EXEC_STRATEGY );
|
||||||
}
|
}
|
||||||
|
tag = findInClassHierarchy( javaClass, JavaMojoAnnotation.EXECUTION_STATEGY );
|
||||||
|
if ( tag != null )
|
||||||
|
{
|
||||||
|
mojoDescriptor.setExecutionStrategy( tag.getValue() );
|
||||||
|
}
|
||||||
|
|
||||||
// Phase name
|
// Phase name
|
||||||
DocletTag phase = findInClassHierarchy( javaClass, JavaMojoAnnotation.PHASE );
|
DocletTag phase = findInClassHierarchy( javaClass, JavaMojoAnnotation.PHASE );
|
||||||
|
|
|
||||||
|
|
@ -155,6 +155,14 @@ public class JavaMojoDescriptorExtractorTest
|
||||||
return descriptor.getMojos();
|
return descriptor.getMojos();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testShouldFindTwoMojoDescriptorsInTestSourceDirectory()
|
||||||
|
throws Exception
|
||||||
|
{
|
||||||
|
List<MojoDescriptor> results = extract( "source" );
|
||||||
|
|
||||||
|
assertEquals( "Extracted mojos", 2, results.size() );
|
||||||
|
}
|
||||||
|
|
||||||
public void testShouldPropagateImplementationParameter()
|
public void testShouldPropagateImplementationParameter()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -76,7 +76,7 @@
|
||||||
<language>java</language>
|
<language>java</language>
|
||||||
<configurator>"role-hint"</configurator>
|
<configurator>"role-hint"</configurator>
|
||||||
<instantiationStrategy>singleton</instantiationStrategy>
|
<instantiationStrategy>singleton</instantiationStrategy>
|
||||||
<executionStrategy>once-per-session</executionStrategy>
|
<executionStrategy>always</executionStrategy>
|
||||||
<deprecated>deprecation text test</deprecated>
|
<deprecated>deprecation text test</deprecated>
|
||||||
<requiresDependencyCollection>test</requiresDependencyCollection>
|
<requiresDependencyCollection>test</requiresDependencyCollection>
|
||||||
<threadSafe>true</threadSafe>
|
<threadSafe>true</threadSafe>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue