Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Scala sbt console - code changes not reflected in sbt console

Tags:

scala

sbt

I use scala sbt console to test my methods. (commands : sbt then console) But the code changes done in eclipse or other external editor, are not getting reflected in the sbt console.

Every time, I have to quit the console (using Crt + D) and again start it using console command to see the changes.

Any one facing this problem? Is there any ways to reload the code from console?

I am using Ubuntu 64-Bit,

like image 937
Karthik Chandraraj Avatar asked Oct 03 '12 07:10

Karthik Chandraraj


People also ask

How do I clear my sbt console?

In bash you should be able to use Ctrl+L, on OSX you can also use Cmd+K.

What does sbt reload do?

Reload an sbt project IntelliJ IDEA cannot reload just a part of your project, it reloads the whole project including subprojects and dependencies.

What is the difference between sbt and Scala?

If you call scala, you will get whatever scala version is installed on the path of your operating system. If you call sbt console, you get the scala version configured in the sbt build (build. sbt) with all libraries that are used in the build already on the classpath.


1 Answers

Not without using something like JRebel, mostly because class definitions could break in such a way as to make instances already loaded unusable. The only suggestion I have is to run the console with ~console so that if changes have been made they will be recompiled and the console re-entered.

Also if you're regularly running a set of commands the initialCommands sbt setting configures commands to be run immediately after starting the console.

like image 167
Sean Parsons Avatar answered Sep 19 '22 23:09

Sean Parsons