添加链接
link之家
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
相关文章推荐
悲伤的熊猫  ·  css ...·  1 年前    · 
Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

I'm running IntelliJ Ultimate 2022.2.2. For quite some time (and versions) it has been complaining that the Project JDK is misconfigured and giving red lines under basically everything. This wasn't much of a problem aside from being very annoying, because the build configurations and Maven tasks still worked, but now it appears that breakpoints don't work anymore, which is a bit of an issue.

The exact issue is that in the POM, the Java version is set to 11. The JDK is also set to 11, as is the language level. IntelliJ, however, will only remove the warning (and red lines) if the JDK is set to 8 instead. Of course, doing that causes compilation and Maven tasks to fail, because the POM specifies that Java 11 must be used.

As stated above, I tried following IntelliJ's suggestion of changing the JDK to Java 8, which removed the editor warnings and errors, but caused compilation and Maven jobs to fail. Leaving it at 11 compiles and runs just fine, but the editor is filled with errors and warnings and breakpoints don't function.

I've also tried a clean checkout with invalidated caches, but that resulted in the exact same situation.

Why, then, does IntelliJ claim the project JDK is misconfigured, and how can I convince it that it really isn't?

Maybe it's the non-Java-8 JDK inside of IntelliJ that's configured wrongly somehow? Try checking Project Structure -> SDKs and see which JDKs you have configured. Joachim Sauer Nov 10, 2022 at 9:33 Could you click on Reload All Maven Projects in the Maven tool window and provide screenshots from File | Project Structure | Project , File | Project Structure | SDKs | select JDK configured for the project , File | Project Structure | Modules | select your module | Depenedencies ? Egor Klepikov Nov 10, 2022 at 10:40

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question . Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers .