maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agud...@apache.org
Subject svn commit: r1727173 - in /maven/plugins/trunk/maven-compiler-plugin/src/it/MCOMPILER-203-processorpath: annotation-processor/src/main/java/org/issue/SimpleAnnotationProcessor.java invoker.properties
Date Wed, 27 Jan 2016 20:08:03 GMT
Author: agudian
Date: Wed Jan 27 20:08:03 2016
New Revision: 1727173

URL: http://svn.apache.org/viewvc?rev=1727173&view=rev
Log:
[MCOMPILER-235] extend IT to verify that the repeated build without a clean works when using
an annotation processor that generates java sources.

Modified:
    maven/plugins/trunk/maven-compiler-plugin/src/it/MCOMPILER-203-processorpath/annotation-processor/src/main/java/org/issue/SimpleAnnotationProcessor.java
    maven/plugins/trunk/maven-compiler-plugin/src/it/MCOMPILER-203-processorpath/invoker.properties

Modified: maven/plugins/trunk/maven-compiler-plugin/src/it/MCOMPILER-203-processorpath/annotation-processor/src/main/java/org/issue/SimpleAnnotationProcessor.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-compiler-plugin/src/it/MCOMPILER-203-processorpath/annotation-processor/src/main/java/org/issue/SimpleAnnotationProcessor.java?rev=1727173&r1=1727172&r2=1727173&view=diff
==============================================================================
--- maven/plugins/trunk/maven-compiler-plugin/src/it/MCOMPILER-203-processorpath/annotation-processor/src/main/java/org/issue/SimpleAnnotationProcessor.java
(original)
+++ maven/plugins/trunk/maven-compiler-plugin/src/it/MCOMPILER-203-processorpath/annotation-processor/src/main/java/org/issue/SimpleAnnotationProcessor.java
Wed Jan 27 20:08:03 2016
@@ -35,6 +35,7 @@ import javax.lang.model.element.PackageE
 import javax.lang.model.element.TypeElement;
 import javax.lang.model.util.Elements;
 import javax.tools.FileObject;
+import javax.tools.JavaFileObject;
 import javax.tools.StandardLocation;
 
 @SupportedSourceVersion( SourceVersion.RELEASE_6 )
@@ -65,13 +66,25 @@ public class SimpleAnnotationProcessor
 
             try
             {
+                Name packageName = packageElement.getQualifiedName();
                 FileObject resource =
-                    filer.createResource( StandardLocation.SOURCE_OUTPUT, packageElement.getQualifiedName(),
name
+                    filer.createResource( StandardLocation.SOURCE_OUTPUT, packageName, name
                         + ".txt", element );
 
                 Writer writer = resource.openWriter();
                 writer.write( name.toString() );
                 writer.close();
+
+                String className = name + "Companion";
+                JavaFileObject javaFile = filer.createSourceFile( packageName + "." + className,
element );
+
+                Writer javaWriter = javaFile.openWriter();
+                javaWriter.append( "package " ).append( packageName ).append( ";\n\n" );
+                javaWriter.append( "public class " ).append( className ).append( " {\n" );
+                javaWriter.append( "    public " ).append( className ).append( "() {\n" );
+                javaWriter.append( "        System.out.println(\"Hey there!\");\n" );
+                javaWriter.append( "    }\n}\n" );
+                javaWriter.close();
             }
             catch ( IOException e )
             {

Modified: maven/plugins/trunk/maven-compiler-plugin/src/it/MCOMPILER-203-processorpath/invoker.properties
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-compiler-plugin/src/it/MCOMPILER-203-processorpath/invoker.properties?rev=1727173&r1=1727172&r2=1727173&view=diff
==============================================================================
--- maven/plugins/trunk/maven-compiler-plugin/src/it/MCOMPILER-203-processorpath/invoker.properties
(original)
+++ maven/plugins/trunk/maven-compiler-plugin/src/it/MCOMPILER-203-processorpath/invoker.properties
Wed Jan 27 20:08:03 2016
@@ -17,3 +17,4 @@
 
 invoker.java.version = 1.6+
 invoker.goals=clean process-test-classes
+invoker.goals.2=process-test-classes



Mime
View raw message