The fork option in sbt changes the working directory

(in some cases)

Posted by Boris Stumm on Sunday, 13 May 2018

A while ago I wondered why a sbt-build suddenly could not find some files anymore, just because I changed the fork option in the build definition. Googling it provided the answer in some bug ticket. When not forking, workingDirectory will be set to the value of the root project folder, but when forking, the workingDirectory of subprojects will be set to the respective module directory.

The best way to deal with that is probably to not rely on the workingDirectory value the build, or to not switch the fork option too often in order to avoid trouble.