I am writing a simple custom annotation in Java and running into a problem with it. Here is the main parts of my code.
LogMeCustomAnnotation.java
The default maven lifecycle runs javac with javax.annotation.processing.Processor file as a part of classpath. This cause compiler to expect a compiled instance of annotation processors listed in the files. But LogMeCustomAnnotationProcessor
is not compiled at that moment so compiler raises "Bad service configuration file ..." error. See bug report.
To solve this issue maven compilation phase can be separated to compile annotation processor at the first place and then compile whole project.
org.apache.maven.plugins
maven-compiler-plugin
3.5.1
1.8
default-compile
-proc:none
fun/n/learn/annotation/LogMeCustomAnnotationProcessor.java
compile-project
compile
compile
default-compile
execution compiles LogMeCustomAnnotationProcessor
with disabled annotation processing in order to have successful compilation.
compile-project
compiles whole project with annotaton processing.