scala:运行 一个 play-slick 示例导致导入错误
scala: Running a play-slick sample results in import error
这里绝对是 Scala 初学者。我在 macOS X 中安装了 scala 2.12.1。
我正在尝试设置示例 computer-database
来自 here
的 Play-Slick 示例
一旦我 cd
进入计算机数据库,我 运行 sbt run
,就会导致这个错误:
error: not found: value PlayKeys "PlayKeys.playOmnidoc := false"
这些是文件夹根目录下 build.sbt
的默认内容:
name := "computer-database-sample"
PlayKeys.playOmnidoc := false
我尝试将以下行添加到 build.sbt
以在 PlayKeys 调用之前显式导入 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项目应该这样设置吗?
停止你正在做的任何修改,恢复它们(你需要从 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...)
这里绝对是 Scala 初学者。我在 macOS X 中安装了 scala 2.12.1。
我正在尝试设置示例 computer-database
来自 here
一旦我 cd
进入计算机数据库,我 运行 sbt run
,就会导致这个错误:
error: not found: value PlayKeys "PlayKeys.playOmnidoc := false"
这些是文件夹根目录下 build.sbt
的默认内容:
name := "computer-database-sample"
PlayKeys.playOmnidoc := false
我尝试将以下行添加到 build.sbt
以在 PlayKeys 调用之前显式导入 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项目应该这样设置吗?
停止你正在做的任何修改,恢复它们(你需要从 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...)