I'm using IntelliJ 13.0.2 on OSX 10.9.5, using java 1.8. I get this error when trying to run a unit test inside IntelliJ. When I run compile or test via maven at the command line, it runs fine.
I've gone into File->Other Settings->Default Settings->Compiler->Annotation Processors and unchecked Enable annotation processing. I've also tried it with Enable annotation processing checked, and left the defaults selected.
We're running our tests with
@RunWith(MockitoJUnitRunner.class)
and the Annotation processor it can't find is org.mapstruct.ap.MappingProcessor. I don't know where it's getting that from, it's not in our imports. Maybe a dependency from Mockito?
Settings -> Build, Execution, Deployment -> Compiler -> Annotation Processors -> Enable Annotation Processing.
Annotation processing isn't enabled by default, though. We need to go to the Preferences | Build, Execution, Deployment | Compiler | Annotation Processors and make sure of the following: Enable annotation processing box is checked.
Annotations provide information to a program at compile time or at runtime based on which the program can take further action. An annotation processor processes these annotations at compile time or runtime to provide functionality such as code generation, error checking, etc.
The annotation processing is done in multiple rounds. Each round starts with the compiler searching for the annotations in the source files and choosing the annotation processors suited for these annotations. Each annotation processor, in turn, is called on the corresponding sources.
This is happening because of realm. You can use these dependencies
classpath "io.realm:realm-gradle-plugin:2.0.0-SNAPSHOT
classpath 'com.android.tools.build:gradle:2.0.0-alpha3
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8
2.0.0 version of snapshots. Good Luck!
In the more general case that I encountered with my own Annotation Processor, here's what was necessary.
In the settings page, choose the "Processor Path" radio button. This has to be the target jar, you should try to locate that MappingProcessor jar.
I believe that this is because when running on the terminal, you would do:javac -cp <pathToAnnotationProcessor.jar> <path to source.java>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With