SBT项目刷新失败[IntelliJ,Scala,SBT] [英] SBT project refresh failed [IntelliJ, Scala, SBT]

查看:1357
本文介绍了SBT项目刷新失败[IntelliJ,Scala,SBT]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每当我尝试在IntelliJ中启用自动导入时,它总是给我这个错误:

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:
...
[warn] ==== public: tried
[warn]   https://repo1.maven.org/maven2/org/scalatest/scalatest_2.12/2.2.6/scalatest_2.12-2.2.6.pom
[info] Resolving org.scala-lang#scala-compiler;2.12.0 ...
[info] Resolving org.scala-lang#scala-reflect;2.12.0 ...
[info] Resolving org.scala-lang.modules#scala-xml_2.12;1.0.5 ...
[info] Resolving jline#jline;2.14.1 ...
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  ::          UNRESOLVED DEPENDENCIES         ::
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  :: org.scalatest#scalatest_2.12;2.2.6: not found
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn] 
[warn]  Note: Unresolved dependencies path:
[warn]      org.scalatest:scalatest_2.12:2.2.6 (/Users/sarahbaka/Desktop/Scala/Example/build.sbt#L7-8)
[warn]        +- default:example_2.12:1.0
[trace] Stack trace suppressed: run 'last *:update' for the full output.
[trace] Stack trace suppressed: run 'last *:ssExtractDependencies' for the full output.
[error] (*:update) sbt.ResolveException: unresolved dependency: org.scalatest#scalatest_2.12;2.2.6: not found
[error] (*:ssExtractDependencies) sbt.ResolveException: unresolved dependency: org.scalatest#scalatest_2.12;2.2.6: not found
[error] Total time: 4 s, completed 08-Nov-2016 22:24:34</pre><br/>

我已经安装了JetBrains Scala插件,然后用SBT构建打开了一个目录并重置/重启了我的缓存(文件 - >无效缓存/重新启动)。但它仍然无效!有谁知道为什么?

I already installed the JetBrains Scala plugin, then opened a directory with an SBT build and reset/restarted my cache (File -> Invalidate Caches / Restart). But it still doesn't work! Does anyone know why?

推荐答案

您的最糟糕的依赖项配置错误。您想要为Scala 2.12发布的scalatest 2.6版。没有这样的组合,因此您的构建失败。如果你看看Scala 2.12的scalatest版本是什么,这里是链接。如您所见,它只有3.0.0版本。因此,您有3个选项(您需要在 build.sbt 文件中进行更改):

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. 将您的最新版本更新为3.0.0: libraryDependencies + =org.scalatest%%scalatest%3.0.0%Test

  2. 将Scala版本降级为2.11: scalaVersion:=2.11.8

  3. 以上两个

我说使用Scala 2.12还为时尚早,因为它只发布了几天以前,并没有为它发布所有依赖项。 Scala主要版本(2.11 vs 2.12是Scala的主要版本升级)不是二进制兼容的,因此您不能在使用另一个的项目中使用使用一个Scala版本编译的库。

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.

与此同时,我会使用最新的3.0.0版本,因为它是稳定版本。总而言之,即使选项1和2将以不同的方式解决这一特定问题,我也会选择第3选项。

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.

这篇关于SBT项目刷新失败[IntelliJ,Scala,SBT]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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