Working through sbt test deadlock

Today, I encountered an issue while running tests for one of my Scala SBT projects. Each time, ran sbt test command hang. After running jvisualvm, I discovered that it is due to thread deadlock. I couldn’t figure out why deadlock is happening. Test cases worked fine when ran individually. To work through this issue, I disabled parallel execution of tests.

From command-line, you can use following command to disable parallel execution of test:

$ sbt 'set parallelExecution in Test := false' test

You can also set this setting in your build.sbt to avoid setting this setting manually.In your build.sbt , add the following line.

parallelExecution := false

SBT: The Missing Tutorial

Welcome to the second blog of 52-technologies-in-2016 blog series. From last year, I have started using Scala as my main programming language. One of the tools that you have to get used to while working with a programming language is a build tool. In my office projects, we use Gradle for all our projects be it Scala or Java. In most of my personal Scala projects, I have started using sbt as my preferred build tool. sbt is a general purpose build tool written in Scala. Most of the time we try to hack our way while using a build tool never learning it properly. As Scala will be the language that I will cover most in this series, I decided to thoroughly learn sbt this week. We(developers) often underestimate the importance of learning a build tool thoroughly and end up not using build tool in the most effective way. Good working knowledge of a build tool can make us more productive so we should take it seriously.

You can read full blog here https://github.com/shekhargulati/52-technologies-in-2016/blob/master/02-sbt/README.md