Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/github/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Scala 如何在sbt配置中添加github java依赖项?_Scala_Github_Sbt - Fatal编程技术网

Scala 如何在sbt配置中添加github java依赖项?

Scala 如何在sbt配置中添加github java依赖项?,scala,github,sbt,Scala,Github,Sbt,我已将此代码添加到Build.scala中 lazy val root = Project("root", file(".")) dependsOn(jbcrypt) lazy val jbcrypt = RootProject(uri("https://github.com/jeremyh/jBCrypt.git")) 但sbt失败,错误如下: [error] (root/*:update) sbt.ResolveException: unresolved dependency: d

我已将此代码添加到Build.scala中

  lazy val root = Project("root", file(".")) dependsOn(jbcrypt)
  lazy val jbcrypt = RootProject(uri("https://github.com/jeremyh/jBCrypt.git"))
但sbt失败,错误如下:

[error] (root/*:update) sbt.ResolveException: unresolved dependency: default#jbcrypt_2.11;0.1-SNAPSHOT: not found
如何告诉sbt它是Java而不是Scala

如何引用特定的分支或标记


谢谢。

只有当引用的项目是sbt项目时,才可能从源代码构建项目。sbt不知道所有不同的构建系统,那么它怎么知道如何构建非sbt项目呢

可以通过sbt插件添加对其他构建系统的支持,但这可能需要大量工作

您引用的项目是一个简单的Maven项目,这意味着您可以轻松地从中创建sbt项目。只需完成回购并创建一个包含以下内容的
build.sbt

scalaVersion := "2.11.5"

projectDependencies += "junit" % "junit" % "3.8.1" % "test"

publishTo := {
  val nexus = "https://oss.sonatype.org/"
  if (isSnapshot.value) Some("snapshots" at nexus + "content/repositories/snapshots")
  else Some("releases" at nexus + "service/local/staging/deploy/maven2")
}
这是启动并运行它所需的最少代码。sbt似乎要求指定发布repo,它似乎还需要显式的Scala版本。链接的Maven项目已经指定了依赖项

当然,您知道需要更改
RootProject
的URI以指向fork的位置

关于第二个问题:您可以通过将提交/标记/分支附加到URI来引用它,并用
符号分隔:

uri("git://github.com/your/repo#<commit-hash/tag/branch>")
uri(“git://github.com/your/repo#")

您有什么理由不想从maven central解决这个问题吗?@m-z mvnrepository只有旧版本的库“0.3m”。我想使用master branch的新版本。我非常确定,如果您试图依赖的项目没有SBT构建(尽管SBT中不断添加的内容让我感到惊讶,谁知道呢),这是不可能的。