【问题标题】:SBT Unresolved DependenciesSBT 未解决的依赖关系
【发布时间】:2015-04-29 02:23:41
【问题描述】:

这是我编写的 SBT 构建文件

name := "Introduction"

version := "1.0"

scalaVersion := "2.11.2"

resolvers ++= Seq(
    "snapshots" at "http://oss.sonatype.org/content/repositories/snapshots",
    "releases" at "http://oss.sonatype.org/content/repositories/releases"
    )

libraryDependencies ++= Seq("org.specs2" %% "specs2" % "1.12.3" % "test")

当我运行 sbt compile 时,我收到错误消息

[info] Resolving org.specs2#spec2_2.11;1.12.3 ...
[warn]  module not found: org.specs2#spec2_2.11;1.12.3
[warn] ==== local: tried
[warn]   C:\Users\Abhishek\.ivy2\local\org.specs2\spec2_2.11\1.12.3\ivys\ivy.xml
[warn] ==== public: tried
[warn]   https://repo1.maven.org/maven2/org/specs2/spec2_2.11/1.12.3/spec2_2.11-1.12.3.pom
[warn] ==== snapshots: tried
[warn]   http://oss.sonatype.org/content/repositories/snapshots/org/specs2/spec2_2.11/1.12.3/spec2_2.11-1.12.3.pom
[warn] ==== releases: tried
[warn]   http://oss.sonatype.org/content/repositories/releases/org/specs2/spec2_2.11/1.12.3/spec2_2.11-1.12.3.pom
[info] Resolving jline#jline;2.12 ...
[info] downloading https://repo1.maven.org/maven2/org/scala-lang/scala-library/2.11.2/scala-library-2.11.2.jar ...
[info]  [SUCCESSFUL ] org.scala-lang#scala-library;2.11.2!scala-library.jar (1827ms)
[info] downloading https://repo1.maven.org/maven2/org/scala-lang/scala-compiler/2.11.2/scala-compiler-2.11.2.jar ...
[info]  [SUCCESSFUL ] org.scala-lang#scala-compiler;2.11.2!scala-compiler.jar (3875ms)
[info] downloading https://repo1.maven.org/maven2/org/scala-lang/scala-reflect/2.11.2/scala-reflect-2.11.2.jar ...
[info]  [SUCCESSFUL ] org.scala-lang#scala-reflect;2.11.2!scala-reflect.jar (1375ms)
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  ::          UNRESOLVED DEPENDENCIES         ::
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  :: org.specs2#spec2_2.11;1.12.3: not found
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]
[warn]  Note: Unresolved dependencies path:
[warn]          org.specs2:spec2_2.11:1.12.3 (D:\myapps\Scala\hw\build.sbt#L12-13)
[warn]            +- introduction:introduction_2.11:1.0

【问题讨论】:

  • 那是相当旧的 specs2 版本(2.5 年)。它尚未针对 scala 2.11 发布。

标签: scala sbt


【解决方案1】:

使用:

libraryDependencies += "org.specs2" % "specs2_2.11.0-RC3" % "2.3.10"

【讨论】:

  • 根据你的scala版本,在maven仓库中搜索:mvnrepository.com/artifact/org.specs2/specs2_2.11.0-RC3/2.3.10:)
  • 如果是这样......我可以参数化我的 scala 版本吗?这样如果我明天从 2.11 迁移到 2.12,我就不必在整个文件中进行搜索和替换?
  • 我认为它行不通。因为你不知道发生了什么变化。
  • 是的,您可以使用"org.specs2" %% "specs2" % "2.3.10"。注意%%,这就是 scala 版本部分的作用
  • 这不是正确的版本 :) 您应该查看 mvnrepository.com/artifact/org.specs2/specs2_2.11 代替。这样您就可以正常使用%% "specs2"。这个可能会起作用,或者它可能有一些微妙的二进制不兼容。
猜你喜欢
  • 2013-10-27
  • 1970-01-01
  • 2014-12-18
  • 2012-02-02
  • 2017-10-29
  • 2014-01-12
  • 2018-08-18
  • 2017-06-13
  • 1970-01-01
相关资源
最近更新 更多