java-How to solve Compilation failure: Provider AnnotationProcessor not found
1. The purpose of this post
This post would demo how to solve this exception when we use annotation processing with java:
3. How to reproduce this exception
By default ,you use this maven compiler plugin:
If we run mvn clean compile, then we got the above error.
4. How to solve this exception
Change your maven pom.xml like this:
rerun the build command mvn clean compile, then we get this:
The problem is that the maven-compiler-plugin will trigger compiler during compilation of our annotation-processor, and since the processor itself is not yet compiled, the compiler will show the error about it. So we need to skip annotation processing to avoid this. This can be done using -proc:none.
According to maven documents:
maven compiler plugin’s proc settings:
Sets whether annotation processing is performed or not. Only applies to JDK 1.6+ If not set, both compilation and annotation processing are performed at the same time.