SBT terminates silently when failing to download plugin via SSH from remote Git repository

I’m pretty sure I found a bug in SBT where it fails silently when downloading a plugin via SSH from a remote Git repository fails for any reason, one example being that the SSH Agent isn’t set up properly.

Details are here:

Answered it -

Just to make sure that it hasn’t been fixed already, could try with the latest 1.2.1 please?

It has the same behaviour with SBT 1.2.1.

Could you help me with getting SBT to build? I’m following the instructions in the contribution guide, but I’m getting errors:

After running:

for i in sbt io util librarymanagement zinc; do \
  git clone$i.git && (cd $i; git checkout -b 1.x origin/1.x);
cd sbt
# lots of build output

sbt:sbtRoot> compile
# lots of build output

I eventually get this error:

[error] /Users/nhooey/git/github/sbt/util/internal/util-scripted/src/main/java/sbt/internal/scripted/ cannot access xsbti.Logger
[error]   bad class file: /Users/nhooey/git/github/sbt/util/internal/util-interface/target/util-interface-1.2.0-39070c18e2280bb6532c13709bb12226259c2960.jar(xsbti/Logger.class)
[error]     class file has wrong version 54.0, should be 52.0
[error]     Please remove or make sure it appears in the correct subdirectory of the classpath.
[error] import xsbti.Logger;

It seems like there’s some confusions around different Java versions in the path? I use jenv

Like I wrote on Stackoverflow, I think you can just launch sbt normally and type publishLocal for sbt/sbt only for this change unless you need to change librarymanagement together.

Anyway, the problem with the actual SBT Git cloning code could be found if there was some debug logging in this part of Resolvers.scala.

How can I use the log.debug() function in the context below?

I know I have to at least do import sbt.util.Logger, but I looked through the rest of the code and it’s unclear how to get a log instance variable.

  val git: Resolver = (info: ResolveInfo) => {
    val uri = info.uri.withoutMarkerScheme
    val localCopy = uniqueSubdirectoryFor(uri.copy(scheme = "git"), in = info.staging)
    val from = uri.withoutFragment.toASCIIString

    if (uri.hasFragment) {
      val branch = uri.getFragment
      Some { () =>
        creates(localCopy) {
          run("git", "clone", from, localCopy.getAbsolutePath)
          run(Some(localCopy), "git", "checkout", "-q", branch)
    } else
      Some { () =>
        creates(localCopy) {
          run("git", "clone", "--depth", "1", from, localCopy.getAbsolutePath)

If the logger isn’t there, then you can’t use sbt’s logger unless you pass that into it.
I’d say use System.err.println("hello") during coding.

I think it’s best to change the code so a log instance is passed all the way through from Load.load() in to Resolver.git, so that when the debug flag is on, SBT will print what it’s actually doing.

I could submit this as a pull request.

What do you think?

Upon closer inspection, I see in that git function takes ResolveInfo as a parameter. ResolveInfo has config: LoadBuildConfiguration, and LoadBuildConfiguration has log already.