gpt4 book ai didi

scala - 为什么 Scala playframework 不导入库

转载 作者:行者123 更新时间:2023-11-28 20:54:47 24 4
gpt4 key购买 nike

我正在尝试使用 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/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com