Scala: is the console worse than Scala's own REPL?

Using maven-scala-plugin I can start the Scala console with all the dependencies like:

 mvn scala:console 

However, I get a lot more poor REPLs than Scala's own (the one you get when you run scala with no arguments). For instance. it skips automatic completion and history , the arrow keys just prints its code (instead of moving the cursor), etc.

Is this a known issue, or is it just a wrong setup in my setup? First of all, what are the alternatives to scala:console (i.e. REPL with all the dependencies and compiled code)?


Plugin configuration in my pom.xml :

 <plugin> <groupId>org.scala-tools</groupId> <artifactId>maven-scala-plugin</artifactId> <version>2.15.0</version> <executions> <execution> <goals> <goal>compile</goal> <goal>testCompile</goal> </goals> <configuration> <args> <arg>-make:transitive</arg> <arg>-dependencyfile</arg> <arg>${project.build.directory}/.scala_dependencies</arg> </args> </configuration> </execution> </executions> </plugin> 
+6
source share
2 answers

version of org.scala-tools: maven-scala-plugin: 2.x plugin is outdated / dead (due to EOL from scala -tools.org, maven3 convention, ...).

Try

  <groupId>net.alchim31.maven</groupId> <artifactId>scala-maven-plugin</artifactId> <version>3.2.0</version> 

(Note: I am the author of both plugins).

+8
source

I wonder how asking questions on SO makes you think in a different direction and find the answers yourself. It turns out I missed the error message when starting REPL:

Failed to create JLineReader: java.lang.NoClassDefFoundError: scala / tools / jline / console / completer / Completer Returns to SimpleReader.

Which quickly leads to a solution - you just need to add the JLine to the list of dependencies:

 <dependency> <groupId>org.scala-lang</groupId> <artifactId>jline</artifactId> <version>2.9.0-1</version> </dependency> 
+3
source

Source: https://habr.com/ru/post/970800/


All Articles