简体   繁体   English

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

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

IntelliJ highlights the getFirstName method as it is wrong. IntelliJ 突出显示了 getFirstName 方法,因为它是错误的。 However, everything works and compiles.但是,一切正常并编译。 What can I do to make Maven see this method as well?我该怎么做才能让 Maven 也看到这种方法?

强调

班级

sometime the modules are not set properly in "project structure->project settings->modules" and there intelliJ can resolve the class.有时模块在“项目结构->项目设置->模块”中设置不正确,intelliJ可以解析该类。

is it a maven project?它是一个maven项目吗? re-importing it could help.重新导入它可能会有所帮助。

and you use lombok right?你用的是 lombok 吧? intall the lombok-plugin if you haven't如果你还没有安装 lombok-plugin

If everything works and compiles it might not be from Maven. 如果一切正常并且可以编译,则可能不是Maven提供的。 Sometimes IntelliJ gets confused. 有时IntelliJ会感到困惑。 If you haven't done this I'd suggest you to File | 如果您还没有这样做,建议您使用File | Invalidate Caches/Restart 无效的缓存/重启

Hope it helps. 希望能帮助到你。

Edit : As Petr Aleksandrov commented, you can check the Jidea Annotation processor : Configuring Annotation Processing 编辑:正如Petr Aleksandrov所评论的那样,您可以检查Jidea注释处理器: 配置注释处理

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM