You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by vs...@apache.org on 2008/02/01 00:54:53 UTC

svn commit: r617308 - in /maven/plugin-tools/trunk/maven-plugin-tools-java/src/test: java/org/apache/maven/tools/plugin/extractor/java/JavaMojoDescriptorExtractorTest.java resources/source3/ resources/source3/TestAnnotation.java

Author: vsiveton
Date: Thu Jan 31 15:54:48 2008
New Revision: 617308

URL: http://svn.apache.org/viewvc?rev=617308&view=rev
Log:
MPLUGIN-53: Plugin descriptor extractor crashes on certain types of Java source files
Submitted by: Paul Gier
Reviewed by: Vincent Siveton

o applied

Added:
    maven/plugin-tools/trunk/maven-plugin-tools-java/src/test/resources/source3/
    maven/plugin-tools/trunk/maven-plugin-tools-java/src/test/resources/source3/TestAnnotation.java   (with props)
Modified:
    maven/plugin-tools/trunk/maven-plugin-tools-java/src/test/java/org/apache/maven/tools/plugin/extractor/java/JavaMojoDescriptorExtractorTest.java

Modified: maven/plugin-tools/trunk/maven-plugin-tools-java/src/test/java/org/apache/maven/tools/plugin/extractor/java/JavaMojoDescriptorExtractorTest.java
URL: http://svn.apache.org/viewvc/maven/plugin-tools/trunk/maven-plugin-tools-java/src/test/java/org/apache/maven/tools/plugin/extractor/java/JavaMojoDescriptorExtractorTest.java?rev=617308&r1=617307&r2=617308&view=diff
==============================================================================
--- maven/plugin-tools/trunk/maven-plugin-tools-java/src/test/java/org/apache/maven/tools/plugin/extractor/java/JavaMojoDescriptorExtractorTest.java (original)
+++ maven/plugin-tools/trunk/maven-plugin-tools-java/src/test/java/org/apache/maven/tools/plugin/extractor/java/JavaMojoDescriptorExtractorTest.java Thu Jan 31 15:54:48 2008
@@ -117,5 +117,35 @@
 
         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() );
+    
+    }
+
 
 }

Added: maven/plugin-tools/trunk/maven-plugin-tools-java/src/test/resources/source3/TestAnnotation.java
URL: http://svn.apache.org/viewvc/maven/plugin-tools/trunk/maven-plugin-tools-java/src/test/resources/source3/TestAnnotation.java?rev=617308&view=auto
==============================================================================
--- maven/plugin-tools/trunk/maven-plugin-tools-java/src/test/resources/source3/TestAnnotation.java (added)
+++ maven/plugin-tools/trunk/maven-plugin-tools-java/src/test/resources/source3/TestAnnotation.java Thu Jan 31 15:54:48 2008
@@ -0,0 +1,8 @@
+package source3;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.ANNOTATION_TYPE)
+
+public @interface TestAnnotation {
+    
+}

Propchange: maven/plugin-tools/trunk/maven-plugin-tools-java/src/test/resources/source3/TestAnnotation.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugin-tools/trunk/maven-plugin-tools-java/src/test/resources/source3/TestAnnotation.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"