paradigmatic paradigmatic - 2 months ago 9
Scala Question

How to disable package and publish tasks for root aggregate module in multi-module build?

I have a multiproject SBT project, which looks like the example on SBT doc:

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"))
}


Because
root
is just a virtual project to aggregate both subprojects, I would like to avoid package generation (and artifact publication), but still generate package (and publish) for both subprojects.

Is there an easy way to achieve it ?

Answer

Actually, it is pretty easy. Just override the setting for publish in the root project:

base = file(".")) settings (publish := { }) aggregate(foo, bar)
Comments