How can I change the default sbt temporary directory?

773 Views Asked by At

SBT (the scala's interactive build tool) writes in Linux its temporary files in the /tmp directory. How can I change the default temporary directory?

2

There are 2 best solutions below

2
Seth Tisue On BEST ANSWER

What version of sbt are you using?

I'm asking because of this PR: https://github.com/sbt/sbt/pull/5289, which was merged for sbt 1.4.0.

I assume you are using an older version. If you have a reason to stick with the older version, consider setting the java.io.tmpdir system property.

If you are already on 1.4.0 or newer, then you'll need to tell us what files you are seeing written to /tmp under what conditions, since the PR implies that shouldn't be happening.

0
Yevhen Krotov On

Linux/Mac

mkdir /home/user/temp
export JAVA_OPTS="-Djava.io.tmpdir=/home/user/temp"

Dockerfile

RUN mkdir /home/user/temp
ENV JAVA_OPTS="-Djava.io.tmpdir=/home/user/temp"