Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In sbt, how do I create a source dependency on a branch of a local git repository?

Tags:

scala

sbt

sbt has these syntaxes for source dependency projects:

RootProject(file("/a/b/c"))
RootProject(uri("git://github.com/a/b/c#some-branch"))

But I can't find any way to clone from a local git repository which doesn't require something ridiculous like running a git server. I would like to express the following, or a moral equivalent - moral equivalency means it should not require ssh or working DNS or a git server or even working resolution of "localhost", nor should it introduce any form of pointless build fragility. (Manually checking out the desired branch into another working dir and pointing sbt at that is an example of pointless build fragility.)

RootProject(file("/a/b/c#some-branch"))
// This seems like the most plausible syntax,
// but it explodes during cloning - "ssh: Could not resolve hostname git"
RootProject(uri("git:/a/b/c#some-branch"))
like image 734
psp Avatar asked Dec 19 '25 01:12

psp


1 Answers

The second try was very close, assuming that commit is the SHA1 of the commit you want to use and you cloned the repo to /a/b/c:

RootProject(uri(s"git:file:///a/b/c/#$commit"))
like image 107
Markus1189 Avatar answered Dec 21 '25 00:12

Markus1189



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!