IntelliJ `No 'scala-library*.jar' in Scala compiler classpath in Scala SDK Maven: org.scala-lang:scala-library:2.12.7`

huangapple go评论148阅读模式
英文:

IntelliJ `No 'scala-library*.jar' in Scala compiler classpath in Scala SDK Maven: org.scala-lang:scala-library:2.12.7`

问题

scalac: 在Scala SDK Maven中的Scala编译器类路径中没有 'scala-library*.jar':org.scala-lang:scala-library:2.12.7

我正在处理一个现有的大型项目,该项目使用Java 8 + Scala 2.12.7与Maven进行构建。我想要使用IntelliJ Ultimate IDE,版本为2023.1.2,这是我写这篇文章时的当前版本,来处理这个项目。

该项目可以在shell窗口中成功构建,使用以下命令:

mvn clean install -Dfast -DskipTests=true -Dscala-2.12

在IntelliJ的Project Structure -> Platform Settings -> Global Libraries中,我已经下载了scala-sdk-2.12.7。没有配置其他全局库。

我看到了一些相关的stackoverflow帖子,比如这个(https://stackoverflow.com/questions/46827010/no-scala-library-jar-in-every-new-intellij-scala-project/46831548#46831548),但那是几年前的了,虽然出现了相同的错误消息,但答案并不有用,大多数也不适用。我没有使用SBT。而且我不能只是升级到更新的Scala版本,因为这是一个庞大的遗留项目。

我也已经多次执行了“Rebuild Project”和“Invalidate Caches...”(带有重启)操作。

英文:
scalac: No 'scala-library*.jar' in Scala compiler classpath in Scala SDK Maven: org.scala-lang:scala-library:2.12.7

I'm working on a large existing project that uses Java 8 + Scala 2.12.7 with Maven for build. I want to use the IntelliJ Ultimate IDE, version 2023.1.2 which is the current version as of this writing, to work on the project.

This project builds successfully with this command in a shell window:

mvn clean install -Dfast -DskipTests=true -Dscala-2.12

In IntelliJ Project Structure -> Platform Settings -> Global Libraries, I've downloaded scala-sdk-2.12.7. There are no other Global Libraries configured.

I see related stackoverflow threads like this one (https://stackoverflow.com/questions/46827010/no-scala-library-jar-in-every-new-intellij-scala-project/46831548#46831548) but that is years ago and while it's the same error message, the answers aren't helpful and most aren't applicable. I'm not using SBT. And I can't just upgrade to a newer Scala as this is a large legacy project.

I've also done "Rebuild Project" and "Invalidate Caches..." (with restart) several times.

答案1

得分: 2

常见的解决方法是从项目根目录中删除.idea目录,然后从构建文件中重新导入项目

英文:

The common workaround/fix for such problems is to delete .idea directory from the project root and re-import the project from the build file.

huangapple
  • 本文由 发表于 2023年6月1日 00:35:09
  • 转载请务必保留本文链接:https://go.coder-hub.com/76375640.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定