3

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 :)?

cvogt
  • 11,260
  • 30
  • 46
  • I use `sbt publish-local` on dependent project , and set "standard" sbt dependency declaration on my depending project. – crak Jan 28 '15 at 10:39

1 Answers1

2

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.

cvogt
  • 11,260
  • 30
  • 46
jsuereth
  • 5,604
  • 40
  • 40