0

我正在寻找如何安装Scala Ammonite-REPLWindows 8.1但我没有在网上找到任何东西。

有人知道与此相关的事情吗?

有没有办法做到这一点?

4

1 回答 1

0

我终于找到了我自己问题的答案。

似乎Ammonite-REPL 在 Windows 8.1 上不起作用

但是,它仍然可以通过 SBT 实现。

如果您有现有的 SBT 项目,则可以在 Windows 8.1 上运行 Ammonite。为此,请将以下内容添加到您的build.sbt

libraryDependencies += {
  val version = scalaBinaryVersion.value match {
    case "2.10" => "1.0.3"
    case _ => "2.2.0"
  }
  "com.lihaoyi" % "ammonite" % version % "test" cross CrossVersion.full
}

sourceGenerators in Test += Def.task {
  val file = (sourceManaged in Test).value / "amm.scala"
  IO.write(file, """object amm extends App { ammonite.Main.main(args) }""")
  Seq(file)
}.taskValue

// Optional, required for the `source` command to work
(fullClasspath in Test) ++= {
  (updateClassifiers in Test).value
    .configurations
    .find(_.configuration.name == Test.name)
    .get
    .modules
    .flatMap(_.artifacts)
    .collect{case (a, f) if a.classifier == Some("sources") => f}
}

之后,只需点击

C:\Dir\...\projectName> sbt projectName/test:run

就我而言,如下图所示,它工作正常

在此处输入图像描述

于 2020-07-29T23:38:16.417 回答