JHipster EntityName_ 无法解析为变量

JHipster EntityName_ cannot be resolved to a variable

我对 JHipster 生成的代码有奇怪的问题 - 恰好在查询服务文件中。 问题看起来像这样:

EntityName_ cannot be resolved to a variable OtherEntityQueryService.java /project/src/main/java/com/example/project/service

这里是这个错误所在的例子:

    if (criteria.getDescription() != null) {
        specification = specification.and(buildStringSpecification(criteria.getDescription(), EntityName_.description));
    }

此问题不影响构建项目,仅在我的 IDE (Eclipse) 中显示。但是它在 IDE 中产生了太多错误。知道为什么它显示为错误吗?

正如我所料,这是我的 IDEEclipse 的问题。我必须将新的源文件夹 (link) 添加到注释目录。这次改完之后,一切都解决了。

澄清 Greggy 的答案:

  1. 首先运行 MVNW 来自项目文件夹中的命令提示符
  2. (然后在Eclipse中刷新项目)
  3. 转到项目属性中的Java构建路径
  4. 单击 "Add Folder" 和 select target/generated-sources/annotations 文件夹