I have written a custom annotation processor and configured with maven compiler plugin as shown below, I am facing issue with Immutables annotation processor which is in my application class path. When I add my annotation processor via maven compiler plugin, the Immutables is giving compilation errors. I need Immutables as well in my project.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
<generatedSourcesDirectory>${project.build.directory}/generated-sources/</generatedSourcesDirectory>
<annotationProcessors>
<annotationProcessor>
org.smarttechie.TraceAnnotationProcessor
</annotationProcessor>
</annotationProcessors>
</configuration>
</plugin>
Any hints to use Immutables/any annotation processors along with my custom annotation processor.
CodePudding user response:
Package your annotation processor into a JAR and include that JAR as a
compilation dependency. Be sure to add
META-INF/services/javax.annotation.processing.Processor
to your JAR
(contents single line with your processor class name):
org.smarttechie.TraceAnnotationProcessor
If you don't want your new JAR included as a dependency of your generated artifact, mark it prodided and/or true.