SBT 没有找到 Scalatest 2.10.1 [英] SBT not finding scalatest for scala 2.10.1

查看:49
本文介绍了SBT 没有找到 Scalatest 2.10.1的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试学习如何使用 SBT,但我发现以下简单示例无法找到 scalatest 的版本:

I'm trying to learn how to use SBT and the following simple example I've found fails to find the version for scalatest:

name := "DoingItWrong"

version := "0.0.1"

scalaVersion := "2.10.1"

libraryDependencies ++= Seq (
  "org.scalatest" %% "scalatest" % "1.9.1" % "test"
)

我在尝试 sbt 之前使用了 maven,并且以下依赖项工作正常:

I was using maven before trying sbt and the following dependency works ok:

<dependency>                                                            
   <groupId>org.scalatest</groupId>                                    
   <artifactId>scalatest_2.10</artifactId>                             
   <version>1.9.1</version>                                            
</dependency> 

我在尝试运行 SBT 时得到以下输出:

I got the following output trying to run SBT:

$ sbt package              
[info] Loading global plugins from /home/rafael/.sbt/plugins
[info] Set current project to DoingItWrong (in build file:/home/rafael/Dev/DoingItWrong/)
[info] Updating {file:/home/rafael/Dev/DoingItWrong/}default-c52ace...
[info] Resolving org.scala-lang#scala-library;2.10.1 ...
[info] Resolving org.scalatest#scalatest_2.10.1;1.9.1 ...
[warn]  module not found: org.scalatest#scalatest_2.10.1;1.9.1
[warn] ==== local: tried
[warn]   /home/rafael/.ivy2/local/org.scalatest/scalatest_2.10.1/1.9.1/ivys/ivy.xml
[warn] ==== Sonatype snapshots: tried
[warn]   http://oss.sonatype.org/content/repositories/snapshots/org/scalatest/scalatest_2.10.1/1.9.1/scalatest_2.10.1-1.9.1.pom
[warn] ==== public: tried
[warn]   http://repo1.maven.org/maven2/org/scalatest/scalatest_2.10.1/1.9.1/scalatest_2.10.1-1.9.1.pom
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  ::          UNRESOLVED DEPENDENCIES         ::
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  :: org.scalatest#scalatest_2.10.1;1.9.1: not found
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[error] {file:/home/rafael/Dev/DoingItWrong/}default-c52ace/*:update: sbt.ResolveException: unresolved dependency: org.scalatest#scalatest_2.10.1;1.9.1: not found
[error] Total time: 1 s, completed Jun 6, 2013 9:45:49 AM

我是不是缺少一些存储库之类的东西?

I'm I lacking some repository or something?

我也试过 scalaVersion :="2.10.0"2.10.0-M4.Scalatest for Scala 2.10 通过 SBT 的最新可用版本是什么?

I also tried scalaVersion := "2.10.0" and 2.10.0-M4. What is the latest available version for scalatest for Scala 2.10 via SBT?

推荐答案

为了确保这不是潜在的 SBT 项目的配置问题,暂时不要使用 %% 表示法.实际上,这个会自动选择与您当前的 scala 版本相对应的 Jar 版本,这可能与您期望的不同(您的 conf 中的疏忽,某些配置文件中的变量冲突等......).

To be sure that it's not a potential SBT project's configuration issue, don't use for now the %% notation. Indeed, this one automatically chooses the Jar version corresponding to your current scala version, which may be different than the one you expect (oversight in your conf, conflict of variables in some configuration files etc...).

为了隔离你的错误"上下文,更喜欢这个:

Prefer this in order to isolate your "error" context:

libraryDependencies += "org.scalatest" % "scalatest_2.10" % "1.9.1" % "test"

我刚试过,效果很好.

这篇关于SBT 没有找到 Scalatest 2.10.1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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