Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

scala

sbt

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 ?

like image 243
paradigmatic Avatar asked Jan 09 '12 10:01

paradigmatic


1 Answers

Instead of playing whac-a-mole by listing specific tasks to disable (publish, publish-local, publish-signed, etc), another option is to turn off artifact publishing at the source.

publishArtifact := false 

Even though there's no publishing happening, I also found I needed to supply a publishTo value to make sbt-pgp's publish-signed task happy. It needs this value, even if it never uses it.

publishTo := Some(Resolver.file("Unused transient repository", file("target/unusedrepo"))) 
like image 188
Rich Dougherty Avatar answered Oct 02 '22 15:10

Rich Dougherty