Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use deployed artifacts instead of local project in sbt multi project build

I have an sbt multi-project build

lazy val a = project

lazy val b = project.dependsOn(a)

I continuously work on a and b. Sometimes I want to release a new version of b without releasing a new version of a. Of course this requires that b is still compatible to the last released a. How do I easily test this? When I compile and run tests in b it will use my local source code of a, but that often has changed. Instead I would like to compile and test b against the last released artifact of a. I would basically need to be able to temporarily override the behavior. Any ideas :)?

like image 482
cvogt Avatar asked Nov 20 '25 13:11

cvogt


1 Answers

Here's a mechanism to break ALL inter-project dependencies:

val useExternalDeps = settingKey[Boolean]("If true, we don't use inter-project dependencies")

lazy val a = project
lazy val b = project.dependsOn(a).settings(
   useExternalDeps := false,
   fullResolvers := {
      if(!useExternalDeps.value) fullResolvers.value
      else fullResolvers.value.filterNot(_.name == "inter-project")
   }
)

Simply call set useExternalDeps := true in the sbt shell and then Ivy/sbt will stop looking between projects for artifacts.

like image 194
jsuereth Avatar answered Nov 22 '25 04:11

jsuereth



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!