Alex Dean
Alex Dean

Reputation: 16125

How do I refresh updated Git dependency artifacts in SBT?

I've configured SBT (0.11.0) to pull in a GitHub project as a dependency, as per my answer on this question here.

It works fine except that I can't seem to get SBT to re-compile my Git dependency when it gets updated. In other words: if I make an update to the dependency, push to Git and reload my project's SBT and run package, then SBT does not recompile the external Git dependency when compiling my project.

I've tried creating a new branch in my Git dependency (say, forcenew) and updating the branch in my SBT project configuration to use this:

lazy val depProject = RootProject(uri("git://github.com/me/dep-project.git#forcenew"))

But even this doesn't force a refresh. I'm a bit stumped - I can't even find where SBT puts the Git project to compile it (it doesn't seem to be in ~/.sbt/ or ~/.ivy2/)...

Any help greatly appreciated!

Upvotes: 28

Views: 24325

Answers (3)

Destry
Destry

Reputation: 71

A quick hack you can add to your build.sbt:

def removegit = Command.command("removegit"){state =>
  val home = sys.env("HOME")
  val k = ("rm -rf "+ home + "/.sbt/0.13/staging/").!
  state
}

commands ++= Seq(removegit)

And then sbt removegit will wipe that directory. This doesn't do anything smart like checking commits, which would be a great upgrade... The repos are being stored in ~/.sbt/0.13/staging/ on my machine, you may need to adjust that.

Upvotes: 4

Somatik
Somatik

Reputation: 4743

From: https://github.com/sbt/sbt/issues/335

this should be fixed in 0.12.0, just call "sbt update"

It was fixed in 0.12.0 so sbt update is enough, but got back in 13.0 -- for now, you have to wipe dependency from ~/.sbt/staging/ manually

Upvotes: 20

Adam Klein
Adam Klein

Reputation: 476

You likely want to clear out ~/.sbt/staging/

Upvotes: 10

Related Questions