Reputation: 15821
For CI, I'd like to build the project fresh every time. However, sbt compile
ends up littering target
folders all throughout the checkout. git clean -fxd
or similar can remove those files, but is there any way to have SBT just not put them there in the first place?
Is there a way to tell SBT to put compiled files into a separate directory structure, a la CMake?
Upvotes: 1
Views: 412
Reputation: 206
Even if you could instruct sbt to place the output files somewhere else, you'd still need to clean this other directory in order to get a clean compile.
If you want to build your project 'fresh', why not use sbt clean compile
?
Adding the target/
directory to .gitignore
takes care of the 'littering' from a git perspective.
Upvotes: 0
Reputation: 83245
Easiest way:
target := file("/my/target")
However, SBT will still put files in project/target
, and AFAIK there nothing you can do about that.
Though git clean -fxd
isn't so bad either :) It's the best, most reliable way (no matter what your build tool does) to make a clean working tree.
Upvotes: 1