Where local settings (per user, not per version) go in newer versions (0.10+) of SBT?

My application, which is built using SBT, requires certain settings specific to the host system (and may not even have reasonable defaults). In my particular case, I'm talking about the location of a piece of third-party software with dependent libraries needed for assembly (although there are many other use cases for this). These settings should not be versioned, so they cannot go into build.sbt or project/build.scala , which usually should be in VCS and apply to all project checks.

In older versions of SBT (back to 0.7.7), it was possible to define properties with default settings that can be set by the user in the build.properties file (this code still exists in the SBT source, by the way, but it does not seem to be applicable ) This would do the job for me (despite the lack of strong typing), but no longer an option. I wonder what a more modern alternative is for this supposedly common task.

+4
source share
1 answer

It was amazing to figure it out, but this answer is very simple as soon as you know it. Buried in the “Best Practices” section of the SBT documentation (this seems like a bit of a strange place for him) the “Local Settings” section

Put the settings in the .sbt file in a project that has not been verified for version control, for example /local.sbt. sbt combines settings from several .sbt files, so you can still have the standard /build.sbt and check this for version control.

Simple! First you will need to add some user-configurable settings to your project. To do this, check out this SO answer (the original question is about plugins, but the answer there is great only for one project), which is a very useful addition to the SBT documentation on the subject , which is not entirely clear how IMO can be.

+3
source

Source: https://habr.com/ru/post/1491555/


All Articles