I have a working annotation processor on a Java/Maven project that successfully generates Java code from Java annotations at compile time.
I would like to add a compile time xml processor to do the same thing. I have an xml file in the project that needs to be processed, at compile time, to generate Java code that is included in the compilation. Just like the working annotation processor.
I know how to process the xml and generate the code I want but I don't know how to configure the POM to call the processor on the xml file at compile time or what signature of class it expects to find (e.g. AbstractProcessor).
A simpler option would be to invoke a plain Java program from Maven passing it the context (e.g. the build folder and POM configuration parameters).
Here is my POM configuration for the annotation processor that works:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
<encoding>UTF-8</encoding>
<generatedSourcesDirectory>${project.build.directory}/generated-sources/</generatedSourcesDirectory>
<annotationProcessors>
<annotationProcessor>
bandung.processor.CommandProcessor
</annotationProcessor>
<annotationProcessor>
bandung.processor.ModelProcessor
</annotationProcessor>
</annotationProcessors>
</configuration>
</plugin>