编译Scala Play应用程序时出错

时间:2019-03-23 16:05:22

标签: scala playframework sbt

我有一个scala play应用程序,我正在尝试使用sbt shell进行编译

我的build.sbt文件如下

Task exception was never retrieved
future: <Task finished coro=<AsyncTransport.main_loop() done, defined at /path/to/PythonElasticsearchIngest/venv/lib/python3.6/site-packages/elasticsearch_async/transport.py:143> exception=RuntimeError('Task got bad yield: 200',)>
Traceback (most recent call last):
  File "/path/to/PythonElasticsearchIngest/venv/lib/python3.6/site-packages/elasticsearch_async/transport.py", line 150, in main_loop
    method, url, params, body, headers=headers, ignore=ignore, timeout=timeout)

但是,在编译过程中,我不断遇到错误

name := """template-service"""

version := "2.6.x"

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

scalaVersion := "2.12.4"

crossScalaVersions := Seq("2.11.12", "2.12.4")

libraryDependencies += guice
libraryDependencies += "com.typesafe.play" %% "play-slick" % "3.0.3"
libraryDependencies += "com.typesafe.play" %% "play-slick-evolutions" % "3.0.3"

libraryDependencies += "com.h2database" % "h2" % "1.4.196"

libraryDependencies += specs2 % Test

resolvers += Resolver.url("bintray-sbt-plugins", url("https://dl.bintray.com/sbt/sbt-plugin-releases/"))(Resolver.ivyStylePatterns)

addSbtPlugin("com.geirsson" % "sbt-scalafmt" % "1.5.1")

我尝试重新启动sbt shell并重复上述过程,并始终得到错误。有人可以让我知道build.sbt文件中缺少的内容吗?是某种需要添加的配置设置吗?

任何指针都将非常有帮助。在此先感谢!!!

1 个答案:

答案 0 :(得分:2)

您应该将播放插件带入project/plugins.sbt中: 在项目目录的project目录中,创建一个名为plugins.sbt的文件,并将其添加到其中:

addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.7.0")

其中添加了play sbt插件(特别是play 2.7.0-如果需要,请使用其他版本)。

然后在您的sbt shell中键入reload以重新启动该shell。