Kapt IDEA doesn't know about generated classes

I’m attempting to write an annotation processor that will generate interfaces. It works when I build with gradle, but IDEA doesn’t see the generated classes until I build. And IDEA never shows any of the messages sent via messager. What am I missing?

I threw my code up on github:

Setup:

  1. Checkout the annotation processor
  2. Install it locally: ./gradlew clean install
  3. Checkout the demo
  4. Open it in IDEA
  5. Note that the IFoo interface is not found on class Bar
  6. Compile the demo: ./gradlew clean build
  7. Note that the IFoo interface is now found

Expectation:

I expected the annotation processor to be run in the background in IDEA, to generate the mythical “stubs” which Kapt supposedly produces, so that after annotating something, I can immediately go use it in my code, even before compiling. This should happen while editing. Things like messager error messages which indicate you did something wrong (e.g. annotating an interface should produce an error in this case), never show up in IDEA.

I’ve tried your demo and it perfectly works for me:

  1. Clone AP
  2. ./gradlew install
  3. Clone Demo
  4. Run assemble task from Idea

Result:
Build successful and I have code completion and navigation to generated code

Also, better to split AP and runtime dependencies (like annotations in your case), othewise AP will preset in your runtime class path

UPD: I tried on Idea Ultimate 2018.1 EAP (public preview 1)