IntelliJ在scala源文件中显示错误,但项目编译成功 [英] IntelliJ show errors in scala source files but the project compiles successfully

查看:572
本文介绍了IntelliJ在scala源文件中显示错误,但项目编译成功的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用基于maven的intellij IDEA IDE中的项目。我可以执行所有maven目标,但是IntelliJ在源代码中显示了很多错误,如下所示:

I'm working with project in intellij IDEA IDE based in maven. I can perform all maven goals but IntelliJ is showing a lot of errors in the source code like bellow:

几个小时前一切正常。我不明白为什么IDE继续显示错误的
。当我重建或编译整个项目(CTRL + F9)或单个
scala类时,我总是收到类似的成功消息:

Everything worked fine a few hours ago. I don't understand why the IDE continue showing errors. When I rebuild or compile the entire project (CTRL + F9) or a single scala class I always receive a success message like that:

之前我已经配置了scala插件,所以我不知道会发生什么。

I already had configured scala plugin before, so I don't know what is happen.

感谢您的帮助

推荐答案

如果IDEA丢失了明显正确的类型,例如数据库 DateTime ,它可能意味着配置项目错误或损坏。最常见的是它没有所需的第三部分依赖性,例如Joda Time。

If IDEA has lost track of obviously correct types such as Database or DateTime it probably means the configuration of the project is wrong or corrupted. Most commonly it does not have the required 3rd part dependencies such as Joda Time.

如果您还没有这样做,请仅在SBT中定义您的项目并使用< a href =https://github.com/mpeltonen/sbt-idea =nofollow> sbt-idea 插件,用于生成您的IDEA项目定义。然后,每当您更改项目依赖项时,请重新运行 gen-idea 以重新生成您的IDEA项目文件。没有麻烦,没有大惊小怪。

If you're not already doing so, define your project solely in SBT and use the sbt-idea plug-in to produce your IDEA project definition. Then whenever you change the project dependencies, re-run gen-idea to regenerate your IDEA project files. No muss, no fuss.

这篇关于IntelliJ在scala源文件中显示错误,但项目编译成功的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆