MPLUGIN-53: Plugin descriptor extractor crashes on certain types of Java source files

Submitted by: Paul Gier
Reviewed by: Vincent Siveton

o applied

git-svn-id: https://svn.apache.org/repos/asf/maven/plugin-tools/trunk@617308 13f79535-47bb-0310-9956-ffa450edef68
master
Vincent Siveton 2008-01-31 23:54:48 +00:00
parent 2d1e9161be
commit de55808dc7
2 changed files with 38 additions and 0 deletions

View File

@ -118,4 +118,34 @@ public class JavaMojoDescriptorExtractorTest
return result; return result;
} }
/**
* Check that the mojo descriptor extractor will ignore any annotations that are found.
*
* @throws Exception
*/
public void testAnnotationInPlugin()
throws Exception
{
JavaMojoDescriptorExtractor extractor = new JavaMojoDescriptorExtractor();
File sourceFile = fileOf( "dir-flag.txt" );
File dir = sourceFile.getParentFile();
Model model = new Model();
model.setArtifactId( "maven-unitTesting-plugin" );
MavenProject project = new MavenProject( model );
project.setFile( new File( dir, "pom.xml" ) );
project.addCompileSourceRoot( new File( dir, "source3" ).getPath() );
PluginDescriptor pluginDescriptor = new PluginDescriptor();
pluginDescriptor.setGoalPrefix( "test" );
List results = extractor.execute( project, pluginDescriptor );
assertEquals( 0, results.size() );
}
} }

View File

@ -0,0 +1,8 @@
package source3;
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.ANNOTATION_TYPE)
public @interface TestAnnotation {
}