1

For Scala 2.12.x one could use scala.tools.nsc.interpreter.ILoop to embed the Scala REPL. With Scala 2.13.x scala.tools.nsc.interpreter.ILoop has been removed. How could one embed the Scala 2.13.x REPL?

Mario Galic
  • 47,285
  • 6
  • 56
  • 98
collymy
  • 77
  • 7

1 Answers1

2

Try adding scala-compiler dependency

libraryDependencies += "org.scala-lang" % "scala-compiler" % "2.13.1"

after which, for example, the following compiles

import scala.tools.nsc.interpreter.shell.{ILoop, ShellConfig}
import scala.tools.nsc._

object EmbeddedREPL extend App {
  val settings = new Settings {
    usejavacp.value = true
    deprecation.value = true
  }
  val config = ShellConfig(settings)
  new ILoop(config).run(settings)
}
Mario Galic
  • 47,285
  • 6
  • 56
  • 98