SuperZombi
@SuperZombi

Как запустить sbt console?

Добрый день. С помощью sbt run код скалы запускается успешно, но при попытке открыть интерпретатор выдает следующую ошибку:
Показать
D:\Scala>sbt console
[info] welcome to sbt 1.4.8 (Oracle Corporation Java 1.8.0_281)
[info] loading project definition from D:\Scala\project
[info] set current project to scala (in build file:/D:/Scala/)
[info] Starting scala interpreter...
Welcome to Scala 2.12.12 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_281).
Type in expressions for evaluation. Or try :help.
[error] (Thread-6) java.lang.NoClassDefFoundError: org/fusesource/jansi/AnsiOutputStream
[error] java.lang.NoClassDefFoundError: org/fusesource/jansi/AnsiOutputStream
[error]         at jline.internal.Ansi.stripAnsi(Ansi.java:29)
[error]         at jline.console.ConsoleReader.setPrompt(ConsoleReader.java:528)
[error]         at jline.console.ConsoleReader.readLine(ConsoleReader.java:2454)
[error]         at jline.console.ConsoleReader.readLine(ConsoleReader.java:2407)
[error]         at jline.console.ConsoleReader.readLine(ConsoleReader.java:2395)
[error]         at scala.tools.nsc.interpreter.jline.InteractiveReader.readOneLine(JLineReader.scala:63)
[error]         at scala.tools.nsc.interpreter.InteractiveReader.readLine(InteractiveReader.scala:45)
[error]         at scala.tools.nsc.interpreter.InteractiveReader.readLine$(InteractiveReader.scala:42)
[error]         at scala.tools.nsc.interpreter.jline.InteractiveReader.readLine(JLineReader.scala:31)
[error]         at scala.tools.nsc.interpreter.SplashReader.readLine(InteractiveReader.scala:154)
[error]         at scala.tools.nsc.interpreter.SplashLoop.run(InteractiveReader.scala:82)

Failed to initialize compiler: NoClassDefFoundError.
This is most often remedied by a full clean and recompile.
Otherwise, your classpath may continue bytecode compiled by
different and incompatible versions of scala.
[error]         at java.lang.Thread.run(Unknown Source)

[error] Caused by: java.lang.ClassNotFoundException: org.fusesource.jansi.AnsiOutputStream
java.lang.NoClassDefFoundError: org/fusesource/jansi/AnsiOutputStream[error]    at java.net.URLClassLoader.findClass(Unknown Source)

[error]         at java.lang.ClassLoader.loadClass(Unknown Source)
        at jline.internal.Ansi.stripAnsi(Ansi.java:29)[error]   at java.lang.ClassLoader.loadClass(Unknown Source)

[error]         at jline.internal.Ansi.stripAnsi(Ansi.java:29)
        at jline.console.ConsoleReader.setPrompt(ConsoleReader.java:528)[error]         at jline.console.ConsoleReader.setPrompt(ConsoleReader.java:528)

[error]         at jline.console.ConsoleReader.readLine(ConsoleReader.java:2454)
        at jline.console.ConsoleReader.readLine(ConsoleReader.java:2454)[error]         at jline.console.ConsoleReader.readLine(ConsoleReader.java:2407)

[error]         at jline.console.ConsoleReader.readLine(ConsoleReader.java:2395)
        at jline.console.ConsoleReader.readLine(ConsoleReader.java:2407)[error]         at scala.tools.nsc.interpreter.jline.InteractiveReader.readOneLine(JLineReader.scala:63)

[error]         at scala.tools.nsc.interpreter.InteractiveReader.readLine(InteractiveReader.scala:45)
        at jline.console.ConsoleReader.readLine(ConsoleReader.java:2395)[error]         at scala.tools.nsc.interpreter.InteractiveReader.readLine$(InteractiveReader.scala:42)

[error]         at scala.tools.nsc.interpreter.jline.InteractiveReader.readLine(JLineReader.scala:31)
        at scala.tools.nsc.interpreter.jline.InteractiveReader.readOneLine(JLineReader.scala:63)[error]         at scala.tools.nsc.interpreter.SplashReader.readLine(InteractiveReader.scala:154)

[error]         at scala.tools.nsc.interpreter.SplashLoop.run(InteractiveReader.scala:82)
        at scala.tools.nsc.interpreter.InteractiveReader.readLine(InteractiveReader.scala:45)[error]    at java.lang.Thread.run(Unknown Source)

        at scala.tools.nsc.interpreter.InteractiveReader.readLine$(InteractiveReader.scala:42)
        at scala.tools.nsc.interpreter.jline.InteractiveReader.readLine(JLineReader.scala:31)
        at scala.tools.nsc.interpreter.ILoop.readOneLine(ILoop.scala:444)
        at scala.tools.nsc.interpreter.ILoop.loop(ILoop.scala:456)
        at scala.tools.nsc.interpreter.ILoop.process(ILoop.scala:1048)
        at xsbt.ConsoleBridge.run(ConsoleBridge.scala:75)
        at sbt.internal.inc.AnalyzingCompiler.console(AnalyzingCompiler.scala:209)
        at sbt.Console.console0$1(Console.scala:64)
        at sbt.Console.$anonfun$apply$5(Console.scala:73)
        at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
        at sbt.util.InterfaceUtil$$anon$1.get(InterfaceUtil.scala:17)
        at sbt.TrapExit$App.run(TrapExit.scala:258)
        at java.lang.Thread.run(Unknown Source)

[success] Total time: 7 s, completed 19.03.2021 17:17:26

Как это исправить?
  • Вопрос задан
  • 182 просмотра
Пригласить эксперта
Ответы на вопрос 1
sergey-gornostaev
@sergey-gornostaev
Седой и строгий
Это баг в sbt 1.4.8. В более ранних и более поздних всё должно быть нормально.
Ответ написан
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Похожие вопросы