Java加载了方法,但是Maven看不到

Java loads the method, but Maven can't see it

IntelliJ 突出显示 getFirstName 方法,因为它是错误的。但是,一切正常并编译。我该怎么做才能让 Maven 也看到这个方法?

如果一切正常并编译通过,它可能不是来自 Maven。有时 IntelliJ 会感到困惑。 如果您还没有这样做,我建议您 File | Invalidate Caches/Restart

希望对您有所帮助。

编辑:作为Petr Aleksandrov commented, you can check the Jidea Annotation processor : Configuring Annotation Processing

有时 "project structure->project settings->modules" 中的模块设置不正确,intelliJ 可以解决 class.

是maven项目吗?重新导入它可能会有所帮助。

你用的是lombok吧?如果你还没有安装 lombok-plugin