scala 3 repl does not work with -cp argument, needs -repl as workaround
See original GitHub issueCompiler version
3.0.0 and 3.0.1-RC2
Minimized code and output
The repl cannot be started with a -cp
argument.
In 3.0.0 using the .zip from the release on Ubuntu:
$ scala -cp "some.jar"
warning: command option is not correct.
In 3.0.1-RC2 instead of a warning, the -help
output is printed.
Expectation
- Should start the repl with “some.jar” on claspath.
- Should work as in Scala 2.
Undocumented workaround:
$ scala -cp "some.jar" -repl
Issue Analytics
- State:
- Created 2 years ago
- Comments:8 (5 by maintainers)
Top Results From Across the Web
cannot add a jar to scala repl with the :cp command
No one seems to mention this but the correct solution is using the :require command: scala> :require foo.jar Added 'foo.jar' to classpath.
Read more >Ammonite REPL
The goal of Ammonite is to liberate your Scala code from heavyweight "projects", using the lightweight Ammonite runtime: if you want to run...
Read more >Running scala 3 scripts - Question
I am trying to use Scala 3 as scripting language now, encountered few obstacles, so i wonder what ... The 'scala Hello.scala' did...
Read more >Scala: How to add Jar files and classes to the REPL Classpath
Problem. You want to add individual classes or one or more JAR files ... the REPL session, add the -cp or -classpath argument...
Read more >How to run Scala 3 applications in the command line with ...
This work-around seems to work for me: cs launch scala3-repl:3+ -M dotty.tools.MainGenericRunner -- YourScala3File.scala. This way, you don't even have to ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
If no issues are found with the 3.1.0-RC1 releasing about September 1 then the 3.1.0 final should be about October 13th
Great! (I have just added a note in my teaching material that
-repl
in conjunction with-cp
is not needed from Scala 3.1.0. It will be sent to print on sunday…)