In sbt shell how do I set a setting for a subproject?
I know I can project subproject
then set key := value
, but I don't want to have to keep switching projects. Ideally something not too different from:
set key in subproject := value
Typically, if a key has no associated value in a more-specific scope, sbt will try to get a value from a more general scope, such as the ThisBuild scope. This feature allows you to set a value once in a more general scope, allowing multiple more-specific scopes to inherit the value.
clean – delete all generated sources, compiled artifacts, intermediate products, and generally all build-produced files. reload – reload the build, to take into account changes to the sbt plugin and its transitive dependencies.
I think the problem is that you have defined your projects in build.sbt
, and they seem not to be visible in the sbt console. At least in the current version of sbt - see this issue and this issue that were in fact fixed just a couple of days ago (!)
I have found two ways to overcome this limitation.
set version in "projectId" := "some-version"
With the following build definition file build/Build.scala
:
import sbt._
import Keys._
object Build extends Build {
lazy val projectA, projectB = project
}
you should be fine to execute set version in projectA := "1.42-SNAPSHOT
with the expected effect.
Additionally you could just have the build/Build.scala
containing the project definition and rest of the configuration have in build.sbt
for each submodule. It'd work perfectly fine with set
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With