JPA Static Metamodel not recognized by IntelliJ

Aman Tuladhar picture Aman Tuladhar · Dec 14, 2017 · Viewed 9.9k times · Source

I generated the application with JHipster with Gradle as the build tool.

When I created entity I added filtering support, which generated JPA static metamodel. But IntelliJ doesn't recognize the metamodels.

I have enabled the annotation processor settings on IntelliJ but it doesn't seem to work.

What settings do I have to change for IntelliJ to recognize the JPA static metamodels?

Answer

Aman Tuladhar picture Aman Tuladhar · Dec 20, 2017

To get IntelliJ IDEA to recognize the generated classes, I had to add this line on build.gradle

sourceSets {
    main.java.srcDirs += 'build/generated/source/apt/main'
}

Update

Better solution is to modify IntelliJ Plugin

idea {
    module {
        sourceDirs += file("build/generated/source/apt/main")
        generatedSourceDirs += file("build/generated/source/apt/main")
    }
}