Search code examples
jpaintellij-ideajpa-2.0jhipstermetamodel

JPA Static Metamodel not recognized by IntelliJ


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?


Solution

  • 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")
        }
    }