Sbt not loading the project from its current directory

743 Views Asked by At

When I run SBT in my Scala project that contains a build.sbt file, SBT seems to ignore it and loads the project definition from a different folder and set the current project to that different directory hsperfdata which is weird because this is used as part of Java's performance counter which has nothing to do with what I'm trying to do.

Also SBT was installed via SDKMAN and when I try to specify a lower SDK version 1.2.8 instead of 1.4.6 it will always use 1.4.6. version 1.2.8 is also specified in my build.properties file as well.

My stack trace:

xxxxx@MC-N369748 topic-api % sbt 
OpenJDK 64-Bit Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0
[info] welcome to sbt 1.4.6 (AdoptOpenJDK Java 1.8.0_275)
[info] loading project definition from /private/var/folders/hs/0vkhntfd557c8z8g8b_p7ly00000gp/T/hsperfdata_adu-tp01/project
[info] set current project to hsperfdata_adu-tp01 (in build file:/private/var/folders/hs/0vkhntfd557c8z8g8b_p7ly00000gp/T/hsperfdata_adu-tp01/)
[info] sbt server started at local:///Users/xxxxx/.sbt/1.0/server/143baa47709c908603e6/sock
[info] started sbt server
sbt:hsperfdata_xxxxx> 
1

There are 1 best solutions below

0
On

When we had this issue, it was caused by OS X restricting the permissions of the java executables. Since the process is not able to read/write to the current directory, sbt diverts to the tmp folder.

In System Preferences => Security & Privacy make sure the Full Disk Access property is turned on for the appropriate executables (probably java and javac in this case) or move your source code our of what OS X considers the protected part of the file system (we moved our builds from the user home directory to /code and sbt worked fine).