[英]Showing compile error in IntelliJ-idea in editor
Showing compile error in IntelliJ-idea editor.在 IntelliJ-idea 编辑器中显示编译错误。
mvn clean install
When run it will build successfully and run code normally.运行时它将成功构建并正常运行代码。 But in editor its unable to resolve those import.但是在编辑器中它无法解决这些导入。 Some of the import is showing correctly some of the import it's showing error like Blow某些导入正确显示某些导入显示错误,例如 Blow
and actually, the dependency is present in maven dependency list实际上,依赖项存在于 maven 依赖项列表中
In the editor, it showing full of error在编辑器中,它显示充满错误
I modified build settings, deleted repo, updated maven to the latest version, updated the IntelliJ and tried other suggestion in StackOverflow, still no solution for this problem.我修改了构建设置,删除了 repo,将 maven 更新到最新版本,更新了 IntelliJ 并尝试了 StackOverflow 中的其他建议,但仍然没有解决这个问题。
Try:尝试:
file
> invalidate caches / restart
file
> invalidate caches / restart
I believe this issue is related to the way we open this project in IntelliJ Idea as mvn clean install
is working fine for you.我相信这个问题与我们在 IntelliJ Idea 中打开这个项目的方式有关,因为mvn clean install
对你来说很好用。
While opening the project in IntelliJ, you should open maven project like this:在 IntelliJ 中打开项目时,您应该像这样打开Maven项目:
maven
here) New -> Project from Existing Sources -> Select Project -> Import from External Model(这里选择maven
) This should hopefully solve your problem.这应该有望解决您的问题。
You can invalidate the cache您可以使缓存无效
file -> invalidate caches and restart
selecting first two options shown in invalidate cache has worked for, also you might get compile time error in already opened file so, try closing/opening these already opened files which are showing errors.选择无效缓存中显示的前两个选项已起作用,您也可能在已打开的文件中遇到编译时错误,因此,请尝试关闭/打开这些显示错误的已打开文件。
Clear file system cache and Local History : remove the virtual file system cache together with the information stored in Local History.清除文件系统缓存和本地历史记录:删除虚拟文件系统缓存以及存储在本地历史记录中的信息。
This action might be helpful for troubleshooting purposes when the usual cache invalidation is not enough to solve the problem.
Enabling this option also updates your settings for shared project indexes in Settings/ Preferences | Tools | Shared Indexes.
尝试删除项目下的 .idea 文件夹,完全关闭项目并重新导入,它对我有用。
I resolved this issue by deleting the local maven repository and restoring the default setting of Intellij我通过删除本地maven存储库来解决此问题,并还原Intellij的默认设置
Go to project and do reimport. Go 进行投影并重新导入。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.