简体   繁体   中英

Breakpoints not hit in IntelliJ when debugging my Java annotation processor

I've written a Java annotation processor following Hannes Dorfmann's tutorial. My project uses Maven. When I try to debug it using mvnDebug as suggested in this article, everything works except that my breakpoints are not hit in IntelliJ.

  1. I can run mvnDebug clean compile from the command line.
  2. I can attach IntelliJ's debugger using a remote debugging target.
  3. My annotation processor runs normally. I've added processingEnv.getMessager().printMessage statements to the process method and I they are logged correctly.
  4. The only thing that is not working is the breakpoints. None of the breakpoints I set are hit.

I've tried several things: changing the classpath of the remote debugging target, different versions of maven-compiler-plugin, different options of that plugin (fork, ...), nothing helps.

What am I missing?

The reason is interference or a conflict with the maven-toolchains-plugin , which is also being used in my project. Once I removed that plugin from the POM, debugging and breakpoints work as expected.

Following issue maybe related. Toolchains is definitely doing something strange when it comes to annotation processing: https://issues.apache.org/jira/browse/MTOOLCHAINS-34

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM