Is it necessary to "clean" SBT before "stage" for production builds? Is it necessary to "clean" SBT before "stage" for production builds? jenkins jenkins

Is it necessary to "clean" SBT before "stage" for production builds?


I think it's a matter of taste. For continuous integration builds, it's ok to rely on the incremental compiler; if something fails I can investigate quite quickly.

But if, for whatever reason, the incremental compiler decides to ignore some changes (and it already happened to me in development), you may get some difficult bugs to resolve.

So, if you want something that's reproducible from a fresh code checkout; just run "clean" before everything else.

Most of the time, I configure jenkins with two build tasks: test builds, triggered by code changes, and packaging builds targeted for deployment and triggered periodically (or manually in some cases, with automatic deployment).


If the build script and/or command line to sbt have not changed then it should not be necessary to do clean.

I have been using Spark for several years - and it is one of the most complex sbt builds you can find. It works just fine to avoid doing clean as long as the build process itself (as embodied in the project/sbt build artifacts and the sbt command line) are the same as previous runs.