sbt plugin to enable Ammonite REPL.
Ammonite REPL is a great REPL that make the life easier. Using it require some boilerplate that should be add to each project. This plugin eliminate it.
Add the following lines to one of these files:
- The project-specific file at
project/plugins.sbt
- Your global file at
~/.sbt/0.13/plugins/sbt-ammonite.sbt
(for sbt 0.13.x) - Your global file at
~/.sbt/1.0/plugins/sbt-ammonite.sbt
(for sbt 1.0.x)
resolvers += Resolver.bintrayIvyRepo("vatbox-oss", "sbt-plugins")
addSbtPlugin("com.vatbox" % "sbt-ammonite" % "0.1.1")
ammoniteRepl
Starts the Scala interpreter with the project classes on the classpath.
ammoniteReplQuick
Starts the Scala interpreter with the project dependencies on the classpath.
For the source
command to work, add:
AmmoniteReplPlugin.loadSources
Add to the build:
enablePlugins(AmmoniteSshdPlugin)
and add the REPL server to your application:
import ammonite.sshd._
object passwordChecker extends PasswordAuthenticator {
def authenticate(username: String, password: String, session: ServerSession): Boolean = {
username == "username" && password == "password"
}
}
val replServer = new SshdRepl(
SshServerConfig(
address = "localhost", // or "0.0.0.0" for public-facing shells
port = 22222, // Any available port
passwordAuthenticator = Some(passwordChecker) // or publicKeyAuthenticator
)
)
replServer.start()
To pass arguments to the REPL use the ammoniteArgs
setting, eg:
ammoniteArgs := Seq("--predef-code", """import ammonite.ops._; import ammonite.ops.ImplicitWd._""")
To use different version of ammonite REPL use:
ammoniteVersion := "1.0.1"
- If you've enjoyed using Ammonite, and use it day to day, please chip in to support the project!