com-lihaoyi / Ammonite

Scala Scripting
http://ammonite.io
MIT License
2.61k stars 372 forks source link

Embedding Ammonite in SBT console has stopped working when upgrading Ammonite #1013

Open DavidPerezIngeniero opened 5 years ago

DavidPerezIngeniero commented 5 years ago

I've tried to embed successuflly Ammonite 1.0.3 in my SBT console command by running:

initialCommands in (Test, console) := """ammonite.Main.main(List(),System.in,System.out,System.err)"""

and adding the ammonite-repl dependency.

I've upgraded to Ammonite repl 1.7.4 and it has stopped working. I have an Ammonite console when running test:console, but only see the last character typed. If I hit return, nothing happens, no expression is evaluated.

Maybe is an issue with JLine.

I've read the documentation, and added this:

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

after, I've run the command test:run and the result is that I enter the Ammonite console, but it quits. So there is no chance to enter any command.

 [1] amm
 [2] fcc.vision.runners.OrigenRunner

[info] running (fork) amm 
[error] OpenJDK 64-Bit Server VM warning: ignoring option MaxPermSize=256M; support was removed in 8.0
[error] Loading...
[error] Compiling (synthetic)/ammonite/predef/interpBridge.sc
[error] Compiling (synthetic)/ammonite/predef/replBridge.sc
[error] Compiling (synthetic)/ammonite/predef/sourceBridge.sc
[error] Compiling (synthetic)/ammonite/predef/frontEndBridge.sc
[error] Compiling (synthetic)/ammonite/predef/DefaultPredef.sc
[info] Welcome to the Ammonite Repl 1.7.4
[info] (Scala 2.12.10 Java 1.8.0_222)lass 9s
[info] If you like Ammonite, please support our development at www.patreon.com/lihaoyi
[error] Bye!
@  

I have this dependency:

"com.lihaoyi" %% "ammonite-repl" % "1.7.4" % Test cross CrossVersion.full,
lokolte commented 2 years ago

Try avoiding fork Test / run / fork := false, in your settings