0

I'm looking for how to install Scala Ammonite-REPL in Windows 8.1 but I didn't find anything in the web.

does anyone know something related about this?

Is there any way to do this?

Mario Galic
  • 47,285
  • 6
  • 56
  • 98
Chema
  • 2,748
  • 2
  • 13
  • 24
  • 1
    I would just recommend you to use something like the **WSL** or a virtual machine. Windows isn't really a good OS for development. – Luis Miguel Mejía Suárez Jul 29 '20 at 14:10
  • Hi @Luis thanks for you reply, it's true, I agree with you about Windows, but I don't have `WSL` in windows 8 and I believe that `WSL` cannot be installed in Window 8.1 https://github.com/Microsoft/WSL/issues/3115 . The problem is that I cannot install any virtual machine in that PC either. I have the classic Scala REPL installed, but I wanted Ammonite because I think it's better. – Chema Jul 29 '20 at 15:09
  • Maybe ammonite can work on git bash? Other option would be cygwing. – Luis Miguel Mejía Suárez Jul 29 '20 at 15:57
  • 1
    Thanks @Luis. I found out this: https://github.com/lihaoyi/Ammonite/issues/119 It seems to be that it doesn't work on Windows 8.1. However I found out one way via SBT. – Chema Jul 29 '20 at 23:19

1 Answers1

0

I finally found out an answer to my own question.

It seems to be that Ammonite-REPL doesn't work on Windows 8.1

However, it still can be possible via SBT.

You can run Ammonite on Windows 8.1 if you have an existing SBT project. To do so, add the following to your 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}
}

After that, simply hit

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

In my case as you can see in the picture below it works fine

enter image description here

Chema
  • 2,748
  • 2
  • 13
  • 24