I was investigating a bug that would only happen in production and wanted to attach a debugger to a particular workflow. I could have run the entire application and attached remotely, via: In my case, I wanted to invoke a specific method and see what happens via Scala REPL. Turns out it’s pretty easy to […]
Adding Ammonite REPL to Scala For Ad Hoc Testing
Ammonite is an interactive REPL for Scala, kind of like ipython is for Python. I usually use IntelliJ IDE for Scala (which has a REPL and debugger among other things). Ammonite is great replacement though, when I don’t want to start up full blown IDE. It’s really easy to get started with Ammonite. First it […]
How to install old version of SBT using Homebrew
I’ve recently ran into issue where our projects were expecting to run with SBT version 0.13.12, but the only version that was installing with home-brew via brew install sbt was 1.0.1. Global Setting I’ve Googled and realized that I can install older version with brew install sbt@0.13 but this installed version 0.13.16 which was still […]
Save Ammonite (Scala REPL) History to File
I use Ammonite and ipython like REPL for Scala. I find it handy to save history to file, so here is how to do it in Ammonite. Ammonite exposes a global object called repl, which has a method called history. The code above converts history to a new line separated string and writes it to […]
Write or Paste Multi-Line Code in Scala REPL
I love Python and ipython, so I often crave similar experience when working with Scala. Scala already has a built in REPL which is a huge plus, however, I wasn’t sure how to copy/paste multi-line text. For example, I had a snippet of code saved somewhere that looked as such: This would work fine if […]
Parse JSON Object to Map in Scala Using Jackson
I couldn’t find a good example online, so here it goes. Hope it helps