How to fix Annotation Handler not found in IntelliJ?

I am using IntelliJ 13.0.2 on OSX 10.9.5 using java 1.8. I get this error when trying to run unit test inside IntelliJ. When I run compilation or verification through maven on the command line, it works fine.

I went to File-> Other Settings-> Default Settings-> Compiler-> Annotation Processors and unchecked Enable annotation processing. I also tried it with Enable annotation processing and left selected by default.

We run tests with

@RunWith(MockitoJUnitRunner.class) 

and the annotation processor that he cannot find is org.mapstruct.ap.MappingProcessor. I don’t know where it comes from, it’s not in our import. Maybe addiction to Mockito?

+6
source share
2 answers

This is due to the scope. 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

+5
source

In a more general case, which I came across with my own annotation processor, this was what was needed.

On the settings page, select the "Processor path" radio button. This should be the target bank, you should try to find this MappingProcessor banner.

I believe this is because when you run on the terminal you would do:
javac -cp <pathToAnnotationProcessor.jar> <path to source.java>

+4
source

Source: https://habr.com/ru/post/987602/


All Articles