【问题标题】:scala: Running a play-slick sample results in import errorscala:运行 play-slick 示例会导致导入错误
【发布时间】:2017-05-28 07:25:04
【问题描述】:

这里是绝对的 Scala 初学者。我在 macOS X 中安装了 scala 2.12.1。

我正在尝试从here 设置示例computer-database Play-Slick 示例

一旦我 cd 进入计算机数据库,我运行了 sbt run,它会导致这个错误:

error: not found: value PlayKeys "PlayKeys.playOmnidoc := false"

这些是文件夹根目录下build.sbt 的默认内容:

name := "computer-database-sample"
PlayKeys.playOmnidoc := false

我尝试在调用 PlayKeys 之前将以下几行添加到 build.sbt 以显式导入 play-slick:

libraryDependencies ++= Seq(
    "com.typesafe.slick" %% "slick" % "2.0.0",
    "com.typesafe.play" %% "play-slick" % "0.6.0.1",
    "com.typesafe.slick" %% "slick-extensions" % "3.1.0"
)

但我仍然遇到同样的错误。

我错过了什么吗? scala项目应该这样设置吗?

【问题讨论】:

    标签: scala slick play-slick


    【解决方案1】:

    停止你正在做的任何修改,恢复它们(你需要从 repo 获得干净的版本)。

    执行以下操作(不是最快的根,但可以让您在旅途中探索其他方面):

    1) 转到 repo 根目录。

    2) 类型:sbt - 我不行,先安装sbt

    3) 在第 2 点成功之后,您应该会看到以下内容:

    [pdolega@maracuja play-slick]$ sbt
    [info] Loading project definition from /home/pdolega/projects/slick/play-slick/project
    [info] Compiling 1 Scala source to /home/pdolega/projects/slick/play-slick/project/target/scala-2.10/sbt-0.13/classes...
    Missing bintray credentials /home/pdolega/.bintray/.credentials. Some bintray features depend on this.
    Missing bintray credentials /home/pdolega/.bintray/.credentials. Some bintray features depend on this.
    Missing bintray credentials /home/pdolega/.bintray/.credentials. Some bintray features depend on this.
    Missing bintray credentials /home/pdolega/.bintray/.credentials. Some bintray features depend on this.
    Missing bintray credentials /home/pdolega/.bintray/.credentials. Some bintray features depend on this.
    Missing bintray credentials /home/pdolega/.bintray/.credentials. Some bintray features depend on this.
    [info] Set current project to play-slick-root (in build file:/home/pdolega/projects/slick/play-slick/)
    

    >

    4) 输入:projects。您将看到所有sbt 子项目:

    > projects
    [info] In file:/home/pdolega/projects/slick/play-slick/
    [info]     basic-sample
    [info]     computer-database-sample
    [info]     docs
    [info]     iteratee-sample
    [info]     play-slick
    [info]     play-slick-evolutions
    [info]   * play-slick-root
    [info]     samples
    > 
    

    4) 输入project computer-database-sample

    > project computer-database-sample
    [info] Set current project to computer-database-sample (in build file:/home/pdolega/projects/slick/play-slick/)
    [computer-database-sample] $
    

    5) 现在您可以进行安装test,它将运行编译和之后的所有测试。或者您可以输入 run 来启动这个示例 Play 应用程序。

    [computer-database-sample] $ run
    [warn] Credentials file /home/pdolega/.bintray/.credentials does not exist
    
    --- (Running the application, auto-reloading is enabled) ---
    
    [info] p.c.s.NettyServer - Listening for HTTP on /0:0:0:0:0:0:0:0:9000
    
    (Server started, use Ctrl+D to stop and go back to the console...)
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-08-31
      • 2016-11-28
      • 2014-02-25
      • 2014-09-03
      • 2018-09-14
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多