Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I refresh updated Git dependency artifacts in SBT?

Tags:

scala

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!

like image 921
Alex Dean Avatar asked Jan 14 '12 18:01

Alex Dean


People also ask

Which is the correct way to add dependencies in sbt file?

If you have JAR files (unmanaged dependencies) that you want to use in your project, simply copy them to the lib folder in the root directory of your SBT project, and SBT will find them automatically.

How do we specify library dependencies in sbt?

The libraryDependencies key Most of the time, you can simply list your dependencies in the setting libraryDependencies . It's also possible to write a Maven POM file or Ivy configuration file to externally configure your dependencies, and have sbt use those external configuration files.

Where are sbt dependencies stored?

All new SBT versions (after 0.7. x ) by default put the downloaded JARS into the . ivy2 directory in your home directory. If you are using Linux, this is usually /home/<username>/.

How do I clear my sbt cache?

You can use Pretty Clean to clean the all of dev tools caches including SBT. PrettyClean also cleans the SBT project's target folder.


2 Answers

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

like image 126
Somatik Avatar answered Sep 20 '22 15:09

Somatik


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

like image 31
Adam Klein Avatar answered Sep 22 '22 15:09

Adam Klein