SBT project refresh failed [IntelliJ, Scala, SBT]

后端 未结 1 344
故里飘歌
故里飘歌 2021-01-02 00:48

Whenever I try to enable auto-import in IntelliJ it always gives me this error:

SBT \'Example\' project refresh failed

Error while importing SBT project:
..         


        
相关标签:
1条回答
  • 2021-01-02 01:04

    Your scalatest dependency is misconfigured. You want scalatest version 2.6 published for Scala 2.12. There is no such combination, hence your build fails. If you have a look at which version of scalatest is available for Scala 2.12, here's the link. As you can see, it's only version 3.0.0. So, you have 3 options (those are changes in your build.sbt file you need to make):

    1. Update your scalatest version to 3.0.0: libraryDependencies += "org.scalatest" %% "scalatest" % "3.0.0" % Test
    2. Downgrade your Scala version to 2.11: scalaVersion := "2.11.8"
    3. Both of the above

    I'd say it's a bit too early to use Scala 2.12, since it was only released a couple of days ago, and not all of the dependencies are published for it yet. Scala major versions (2.11 vs 2.12 is a major version upgrade for Scala) are not binary compatible, so you can't use a library compiled with one Scala version in a project that uses the other.

    At the same time, I'd go with scalatest 3.0.0 version, since it's the stable one. So all in all, I'd go for option 3 at the moment, even though options 1 and 2 will fix this particular problem, in different ways.

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