【问题标题】:Scala REPL import SBT fileScala REPL 导入 SBT 文件
【发布时间】:2015-08-14 02:18:30
【问题描述】:

我有一个包含以下内容的 SBT 文件:

name := "Scala Playground"

version := "1.0"

scalaVersion := "2.11.6"

resolvers += "Typesafe Repo" at "http://repo.typesafe.com/typesafe/releases/"

libraryDependencies ++= Seq(
  "com.netflix.rxjava" %% "rxjava-scala" % "0.19.1",
  "com.typesafe.play"  %% "play-json"    % "2.2.1"
)

保存为 scala-playground.sbt。我想在我的 Scala REPL 中使用它。当我尝试执行以下操作时:

sbt scala-playground.sbt

我收到以下错误:

[info] Set current project to Scala Playground (in build file:/home/joe/Desktop/)
[error] Not a valid command: scala-playground
[error] Not a valid project ID: scala-playground
[error] Expected ':' (if selecting a configuration)
[error] Not a valid key: scala-playground (similar: scala-version, scalac-options, scala-binary-version)
[error] scala-playground
[error]                 ^

我在我的 sbt 文件中看不到任何愚蠢的东西。任何人都可以对此有所了解吗?这是在我的 Scala REPL 中获取依赖项的正确方法吗?

我要做的就是在我的 Scala REPL 中加入一些依赖项,以便我可以快速运行和评估某些库。

【问题讨论】:

    标签: scala sbt read-eval-print-loop


    【解决方案1】:

    命令行参数是sbt 命令,而不是您要使用的文件。只需转到带有scala-playground.sbt 文件的目录并从那里运行:

    sbt console
    

    sbt 应该会自动从当前目录加载scala-playground.sbt 文件并打开 Scala 控制台。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-06-01
      • 1970-01-01
      • 2019-02-12
      • 2019-04-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多