No 'scala-library*.jar' in every new IntelliJ Scala Project

后端 未结 5 1519
抹茶落季
抹茶落季 2020-12-29 03:08

I have installed intelliJ-IDEA 2017.2.5 with scala plugin on Ubuntu 16.04LTS. When I create new scala project and try to run it I get:

Error:scalac:

相关标签:
5条回答
  • 2020-12-29 03:34

    Select checkbox "Use SBT shell for build and import" in Idea SBT settings. It might help.

    0 讨论(0)
  • 2020-12-29 03:42

    If you are using sbt 1.0.2, this problem might be due to a bug in sbt. A fix is expected for sbt 1.0.3.

    Related issues:

    • https://youtrack.jetbrains.com/issue/SCL-12591
    • https://github.com/sbt/sbt/issues/3560

    Possible workarounds:

    • configure Scala version 2.12.3
    • OR downgrade to sbt 0.13.16
    0 讨论(0)
  • 2020-12-29 03:47

    Just upgraded 2017.3.3 to 2017.3.4 on sbt 1.0.3 and Scala 2.12.4. Basically, same s*#t again. In my case it was the warning "Skipping scala files without a scala sdk" for each module after project rebuild.

    However, it was only an issue for the sbt project open during the update, whereas the other projects worked fine afterwards. For the broken project, I finally got its checked-out version from git to work (after "invalidate caches" and other hassle.)

    So these steps may hopefully save future trouble:

    1. Add the relevant project config files to VC
    2. Commit project
    3. Close project
    4. Upgrade
    0 讨论(0)
  • 2020-12-29 03:54

    Switching from scala 2.12.2 to 2.12.3 fixed this for me.

    I too had this problem using IntelliJ 2017.2.4. My build.sbt (originating from the "play-scala-starter-example" project) contained:

    scalaVersion := "2.12.2"
    

    I changed this to:

    scalaVersion := "2.12.3"
    

    And then completed a 'Refresh project'.

    I did this after noticing that when I added the most current Scala SDK: scala-sdk-2.12.3 - (File->Project Structure->Modules, select 'root' and 'Dependencies' tab, then add library), and then I moved it to nearly the first position in the classpath, that I passed SBT: org.scala-lang:scala-library:2.12.2:jar along the way. Being first in the classpath, the "No 'scala-library*.jar' in Scala compiler classpath ..." message disappeared.

    0 讨论(0)
  • 2020-12-29 04:00

    In my case upgrading the Scala plugin via IntelliJ options made the trick.

    It could be related to a fixed issue.

    Go to Preferences, filter on Scala. (Plugins - Scala) click on Update. Restart IntelliJ.

    0 讨论(0)
提交回复
热议问题