sbt-git
sbt-git copied to clipboard
JGit from sbt shell doesn't work:Could not find or load main class org.eclipse.jgit.pgm.Main
From the documentation I did these things
addSbtPlugin("com.typesafe.sbt" % "sbt-git" % "0.9.3") in plugins.sbt enablePlugins(GitBranchPrompt) in build.sbt enablePlugins(GitVersioning) in build.sbt useJGit in git.sbt
Using the git command in the sbt shell
I get git status Error: Could not find or load main class org.eclipse.jgit.pgm.Main [error] Nonzero exit code (1) running JGit.
Looks related to the class loading.
After removing useJGit I still get git status Error: Could not find or load main class org.eclipse.jgit.pgm.Main
Then the functionality seems completely broken.
Possible duplicate of https://github.com/sbt/sbt-git/issues/100, which has a possible fix but is awaiting a test case.
I'm seeing this error in 2019 not just in Windows, but also on Travis running Linux. JGitRunner is apparently not getting the classpath that it needs on line 77. It wouldn't work right for Windows for sure, but Travis should be OK. Perhaps sbt is not arranging the classpath as before. This seems not to work:
getClass.getClassLoader match {
case cl: java.net.URLClassLoader =>
val cp = cl.getURLs map (_.getFile) mkString ":"
I think the problem on Linux is just with a transitive dependency, so see #100 for a correction to the code.