I have an SBT project that contains multiple subprojects, i.e.:
> projects
[info] In file:/home/me/src/foo/
[info] popen
[info] foobar-core
[info] * foobar-client
[info] foobar-db
Is there a way to run an action in each of these subprojects? I'm looking for something like publish-all
, since I currently go through all the subprojects and run publish
manually, which gets fairly tedious once there are more than a handful of subprojects.
I'm using sbt-0.11.2
out of inertia, but am willing to upgrade if that helps.
Run “sbt hello” from command line to invoke the task. Run “sbt tasks” to see this task listed.
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.
sbt is a popular tool for compiling, running, and testing Scala projects of any size. Using a build tool such as sbt (or Maven/Gradle) becomes essential once you create projects with dependencies or more than one code file.
If you call scala, you will get whatever scala version is installed on the path of your operating system. If you call sbt console, you get the scala version configured in the sbt build (build. sbt) with all libraries that are used in the build already on the classpath.
You can define a project that aggregates all the other projects. Each action run on this project will be run on all aggregates. Here is an example from the sbt wiki:
import sbt._
import Keys._
object HelloBuild extends Build {
lazy val root = Project(id = "hello",
base = file(".")) aggregate(foo, bar)
lazy val foo = Project(id = "hello-foo",
base = file("foo"))
lazy val bar = Project(id = "hello-bar",
base = file("bar"))
}
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