本文介绍了IntelliJ无法识别JPA静态元模型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用Gradle作为构建工具的JHipster生成了应用程序.

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

当我创建实体时,我添加了过滤支持,从而生成了JPA静态元模型.但是IntelliJ无法识别元模型.

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

我已经在IntelliJ上启用了注释处理器设置,但是它似乎不起作用.

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

我必须更改哪些设置才能使IntelliJ识别JPA静态元模型?

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

推荐答案

要使IntelliJ IDEA识别生成的类,我必须在build.gradle

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'
}

更新

更好的解决方案是修改IntelliJ插件

Better solution is to modify IntelliJ Plugin

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

这篇关于IntelliJ无法识别JPA静态元模型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-20 17:45