gpt4 book ai didi

playframework - 为什么启用play.PlayScala插件会导致“sbt.compiler.EvalException:表达式中键入错误”?

转载 作者:行者123 更新时间:2023-12-04 14:13:36 25 4
gpt4 key购买 nike

我正在尝试将play scala添加为build.sbt中的依赖项:

name := "name" 

version := "0.0"

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

scalaVersion := "2.11.2"

resolvers += Resolver.mavenLocal

organization := "com.suredbits.core"

libraryDependencies ++= {
val sprayV = "1.3.2"
val akkaV = "2.3.8"
Seq(
"org.scalatest" % "scalatest_2.11" % "2.2.0",
"io.spray" %% "spray-can" % sprayV withSources() withJavadoc(),
"io.spray" %% "spray-routing" % sprayV withSources() withJavadoc(),
"io.spray" %% "spray-testkit" % sprayV % "test" withSources() withJavadoc(),
"com.typesafe.akka" %% "akka-actor" % akkaV withSources() withJavadoc(),
"com.typesafe.akka" %% "akka-testkit" % akkaV % "test" withSources() withJavadoc(),
"org.specs2" %% "specs2-core" % "2.4.7-scalaz-7.0.6" % "test" withSources() withJavadoc(),
"org.scalactic" %% "scalactic" % "2.2.1" % "test" withSources() withJavadoc(),
"io.spray" %% "spray-json" % "1.3.0" withSources() withJavadoc(),
"com.github.nscala-time" %% "nscala-time" % "1.6.0" withSources() withJavadoc() ,
"com.novocode" % "junit-interface" % "0.10" % "test" withSources() withJavadoc(),
"ch.qos.logback" % "logback-classic" % "0.9.28" % "test" withSources() withJavadoc(),
"org.slf4j" % "slf4j-nop" % "1.6.4" withSources() withJavadoc()
)
}

testOptions += Tests.Argument(TestFrameworks.JUnit, "-q", "-v", "-s", "-a")

parallelExecution in Test := false

logBuffered := false

scalacOptions ++= Seq("-unchecked", "-deprecation", "-feature")


这是我的 plugins.sbt

// The Typesafe repository
resolvers += "Typesafe repository" at "https://repo.typesafe.com/typesafe/releases/"

//workaround for enablePlugins error in sbt
//dependencyOverrides += "org.scala-sbt" % "sbt" % "0.13.7"

//Play sbt plugin for Play projects
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.2.6")

addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "2.4.0")

addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.11.2")


最后是我的build.properties

sbt.version=0.13.1


我已经阅读了很多stackoverflow帖子,试图解决此问题,包括删除 ~/.sbt目录,然后再次运行 sbt,但这没有用。

错误消息如下:

lazy val root = (project in file(".")).enablePlugins(play.PlayScala)
^
sbt.compiler.EvalException: Type error in expression
at sbt.compiler.Eval.checkError(Eval.scala:384)
at sbt.compiler.Eval.compileAndLoad(Eval.scala:183)
at sbt.compiler.Eval.evalCommon(Eval.scala:152)
at sbt.compiler.Eval.evalDefinitions(Eval.scala:122)
at sbt.EvaluateConfigurations$.evaluateDefinitions(EvaluateConfigurations.scala:272)
at sbt.EvaluateConfigurations$.evaluateSbtFile(EvaluateConfigurations.scala:110)
at sbt.Load$.sbt$Load$$loadSettingsFile$1(Load.scala:710)
at sbt.Load$$anonfun$sbt$Load$$memoLoadSettingsFile$1$1.apply(Load.scala:715)
at sbt.Load$$anonfun$sbt$Load$$memoLoadSettingsFile$1$1.apply(Load.scala:714)
at scala.Option.getOrElse(Option.scala:120)
at sbt.Load$.sbt$Load$$memoLoadSettingsFile$1(Load.scala:714)
at sbt.Load$$anonfun$loadFiles$1$2.apply(Load.scala:721)
at sbt.Load$$anonfun$loadFiles$1$2.apply(Load.scala:721)
at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:244)
at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:244)
at scala.collection.mutable.ResizableArray$class.foreach(ResizableArray.scala:59)
at scala.collection.mutable.ArrayBuffer.foreach(ArrayBuffer.scala:47)
at scala.collection.TraversableLike$class.map(TraversableLike.scala:244)
at scala.collection.AbstractTraversable.map(Traversable.scala:105)
at sbt.Load$.loadFiles$1(Load.scala:721)
at sbt.Load$.discoverProjects(Load.scala:732)
at sbt.Load$.discover$1(Load.scala:545)
at sbt.Load$.loadTransitive(Load.scala:574)
at sbt.Load$.loadProjects$1(Load.scala:442)
at sbt.Load$.loadUnit(Load.scala:446)
at sbt.Load$$anonfun$18$$anonfun$apply$11.apply(Load.scala:281)
at sbt.Load$$anonfun$18$$anonfun$apply$11.apply(Load.scala:281)
at sbt.BuildLoader$$anonfun$componentLoader$1$$anonfun$apply$4$$anonfun$apply$5$$anonfun$apply$6.apply(BuildLoader.scala:91)
at sbt.BuildLoader$$anonfun$componentLoader$1$$anonfun$apply$4$$anonfun$apply$5$$anonfun$apply$6.apply(BuildLoader.scala:90)
at sbt.BuildLoader.apply(BuildLoader.scala:140)
at sbt.Load$.loadAll(Load.scala:334)
at sbt.Load$.loadURI(Load.scala:289)
at sbt.Load$.load(Load.scala:285)
at sbt.Load$.load(Load.scala:276)
at sbt.Load$.apply(Load.scala:130)
at sbt.Load$.defaultLoad(Load.scala:36)
at sbt.BuiltinCommands$.doLoadProject(Main.scala:481)
at sbt.BuiltinCommands$$anonfun$loadProjectImpl$2.apply(Main.scala:475)
at sbt.BuiltinCommands$$anonfun$loadProjectImpl$2.apply(Main.scala:475)
at sbt.Command$$anonfun$applyEffect$1$$anonfun$apply$2.apply(Command.scala:58)
at sbt.Command$$anonfun$applyEffect$1$$anonfun$apply$2.apply(Command.scala:58)
at sbt.Command$$anonfun$applyEffect$2$$anonfun$apply$3.apply(Command.scala:60)
at sbt.Command$$anonfun$applyEffect$2$$anonfun$apply$3.apply(Command.scala:60)
at sbt.Command$.process(Command.scala:92)
at sbt.MainLoop$$anonfun$1$$anonfun$apply$1.apply(MainLoop.scala:98)
at sbt.MainLoop$$anonfun$1$$anonfun$apply$1.apply(MainLoop.scala:98)
at sbt.State$$anon$1.process(State.scala:184)
at sbt.MainLoop$$anonfun$1.apply(MainLoop.scala:98)
at sbt.MainLoop$$anonfun$1.apply(MainLoop.scala:98)
at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:17)
at sbt.MainLoop$.next(MainLoop.scala:98)
at sbt.MainLoop$.run(MainLoop.scala:91)
at sbt.MainLoop$$anonfun$runWithNewLog$1.apply(MainLoop.scala:70)
at sbt.MainLoop$$anonfun$runWithNewLog$1.apply(MainLoop.scala:65)
at sbt.Using.apply(Using.scala:24)
at sbt.MainLoop$.runWithNewLog(MainLoop.scala:65)
at sbt.MainLoop$.runAndClearLast(MainLoop.scala:48)
at sbt.MainLoop$.runLoggedLoop(MainLoop.scala:32)
at sbt.MainLoop$.runLogged(MainLoop.scala:24)
at sbt.StandardMain$.runManaged(Main.scala:53)
at sbt.xMain.run(Main.scala:28)
at xsbt.boot.Launch$$anonfun$run$1.apply(Launch.scala:57)
at xsbt.boot.Launch$.withContextLoader(Launch.scala:77)
at xsbt.boot.Launch$.run(Launch.scala:57)
at xsbt.boot.Launch$$anonfun$explicit$1.apply(Launch.scala:45)
at xsbt.boot.Launch$.launch(Launch.scala:65)
at xsbt.boot.Launch$.apply(Launch.scala:16)
at xsbt.boot.Boot$.runImpl(Boot.scala:32)
at xsbt.boot.Boot$.main(Boot.scala:21)
at xsbt.boot.Boot.main(Boot.scala)
[error] sbt.compiler.EvalException: Type error in expression
[error] Use 'last' for the full log.

最佳答案

在sbt 0.13.5之前,enablePluginssbt.Project中不可用。

要升级,请在project/build.properties中进行以下操作:

sbt.version=0.13.5


不要忘记停止 sbt并重新启动它(否则将无法识别版本更改)。

对于Play 2.2.x项目,您将替换

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




play.Project.playScalaSettings


我很确定Play 2.2.x使用的Akka(2.2.x)版本与您使用的版本(2.3.8)不兼容。您可能会考虑只使用最新的Play 2.3.7。如果选择该路线,则还需要升级到sbt 0.13.5(甚至最新的0.13.7)。

关于playframework - 为什么启用play.PlayScala插件会导致“sbt.compiler.EvalException:表达式中键入错误”?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28238999/

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