当SBT无法从Git存储库通过SSH下载插件时,它就会悄无声息地失败。
这是SBT在试图下载存储库时的输出:
[info] Updating ProjectRef(uri("ssh://git@repository.com/plugin.git"), "plugin")...
# (nothing after that line)
在那之后它就终止了,没有任何解释。这很可能是一个错误,SBT通过SSH从Git存储库下载插件。
成功下载插件时,将打印这一行:
[info] Done updating.
因此,出于某种原因,SBT并没有说明出了什么问题,即使在像这样执行时:
sbt -Xdebug test
以下是相关的配置文件:
# project/build-properties
sbt.version=1.1.5
# project/plugins.sbt
lazy val buildPlugin = RootProject(uri("ssh://git@repository.com/plugin.git"))
lazy val root = (project in file(".")).dependsOn(buildPlugin)
问题:
1.如何让SBT打印更多调试信息?
2.在SBT代码中我可以修复这个错误吗?
3.如何构建和使用我自己版本的SBT?
发布于 2018-08-25 16:50:20
使用https://www.scala-sbt.org/download.html提供的最新启动脚本(截至2018年8月为1.2.1),您可以运行:
$ sbt -debug
见我的答案,https://github.com/sbt/sbt/issues/1120#issuecomment-415553592
以下是一些相关代码:
Load.builtinLoader
- https://github.com/sbt/sbt/blob/v1.2.1/main/src/main/scala/sbt/internal/Load.scala#L480-L488RetrieveUnit
- https://github.com/sbt/sbt/blob/v1.2.1/main/src/main/scala/sbt/internal/RetrieveUnit.scalaResolvers.git
- https://github.com/sbt/sbt/blob/v1.2.1/main/src/main/scala/sbt/Resolvers.scala#L82-L101Resolvers.creates
- https://github.com/sbt/sbt/blob/v1.2.1/main/src/main/scala/sbt/Resolvers.scala#L145-L155 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)
}
}
}
....
def creates(file: File)(f: => Unit) = {
if (!file.exists)
try {
f
} catch {
case NonFatal(e) =>
IO.delete(file)
throw e
}
file
}
https://github.com/sbt/sbt/blob/1.x/CONTRIBUTING.md#build-from-source
为此,您只需要sbt/sbt和publishLocal
。
https://stackoverflow.com/questions/52011640
复制相似问题