Gabriele Petronella Gabriele Petronella - 4 years ago 122
Scala Question

Preserve results of sbt incremental compilation when moving project directory

Consider the scenario: I have a simple scala project managed by sbt, in a directory called


cd foo
sbt compile

It now takes a few seconds and the project compiles correctly.

Now, thanks to sbt incremental compilation, if I run

sbt compile

it terminates the compile task in close to 0 seconds, since the source code hasn't changed.

But if I rename the
directory into

cd ..
mv foo bar

and try to compile it again

cd bar
sbt compile

now the compile task takes again few seconds, hence not using the results from the previous compilation.

Is there a way to preserve the incremental compilation results of a project even when its absolute path on disk has changed?

Answer Source

As it turns out, there's some work in progress to make incremental compilation results cacheable. Here's the relevant PR:

Also, there's an issue (being discussed at the time of this writing) about making zinc's analysis completely machine independent. See

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download