scala - 为什么 Scala playframework 不导入库

标签 scala testing playframework

我正在尝试使用 this tutorial .但是我在尝试导入库时卡住了

import org.scalatestplus.play._

我在我的 build.sbt 中添加了这个依赖

  libraryDependencies += "org.scalatestplus" % "play_2.10" % "1.2.0"

它不更新依赖列表。

如果我尝试更新激活器,我会成功

$ activator update

[info] Loading project definition from /Users/masum/work/app/project
[info] Set current project to app (in build file:/Users/masum/work/app/)
[info] Updating {file:/Users/masum/work/app/}root...
[info] Resolving jline#jline;2.12 ...
[info] downloading http://repo1.maven.org/maven2/org/scalatestplus/play_2.11/1.2.0/play_2.11-1.2.0.jar ...
  [info]    [SUCCESSFUL ] org.scalatestplus#play_2.11;1.2.0!play_2.11.jar (1253ms)
  [info] Done updating.
  [success] Total time: 6 s, completed Mar 3, 2015 5:50:21 PM

即使在那之后我也不能

   import org.scalatestplus.play._

这是我的 build.sbt:-

  lazy val root = (project in file(".")).enablePlugins(PlayScala)

  scalaVersion := "2.11.5"

  libraryDependencies += "org.scalatestplus" % "play_2.11" % "1.2.0" % "test"

 libraryDependencies ++= Seq(
 jdbc,
 anorm,
 cache,
 ws,
 "com.typesafe.slick" % "slick_2.11" % "3.0.0-M1",
 "com.typesafe.play" % "play-slick_2.11" % "0.8.1",
 "org.slf4j" % "slf4j-nop" % "1.6.4",
 "org.postgresql" % "postgresql" % "9.4-1200-jdbc41",
 "org.scalatest" % "scalatest_2.11" % "2.2.4" % "test",
 "org.mockito" % "mockito-core" % "1.10.19" % "test",
 "com.h2database" % "h2" % "1.3.166",
 "org.xerial" % "sqlite-jdbc" % "3.6.20",
 "org.scala-lang" % "scala-actors" % "2.11.0"
 )

怎么了?如何导入 org.scalatestplus.play._

使用测试代码更新更多信息

  class StackSpec extends PlaySpec {

    "A Stack" must {
      "pop values in last-in-first-out order" in {
        val stack = new Stack[Int]
        stack.push(1)
        stack.push(2)
        stack.pop() mustBe 2
        stack.pop() mustBe 1
      }
      "throw NoSuchElementException if an empty stack is popped" in {
        val emptyStack = new Stack[Int]
        a [NoSuchElementException] must be thrownBy {
          emptyStack.pop()
        }
      }
    }
  }

最佳答案

我发现 scalatestplus-play 有问题。检查@

https://github.com/scalatest/scalatestplus-play/issues/15

我在使用时为我工作

  "org.scalatestplus" %% "play" % "1.2.0" % "test"

感谢所有试图支持我的人。

关于scala - 为什么 Scala playframework 不导入库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28836265/

相关文章:

scala - 为 Scala val/var/def 插入推断类型注释

sql - Slick:传入列进行更新

testing - TestComplete - 不正确的交叉引用错误

java - Play Framework 2.2 子项目

url-rewriting - 将Form参数添加到url Play框架

scala - Play Framework Scala : How to Stream Request Body

scala - 在 Scala 中生成文件名的功能方法

design-patterns - 使白盒测试更容易的编程设计模式?

git - Git Flow 应该如何与 QA 一起测试发布和新功能?

scala - ~ 在 Scala 中做什么?