在sbt项目中导入scalding时出错

我有这个错误,为什么导入我的项目build.sbt(ref:How to declare dependency on Scalding in sbt project?)中的烫伤sbt . 请帮助我 .

lazy val scaldingCore = ProjectRef(uri("https://github.com/twitter/scalding.git"), "scalding-core")
lazy val myProject = project in file(".") dependsOn scaldingCore

错误:导入SBT项目时出错:... [warn] ==== public:尝试[warn] https://repo1.maven.org/maven2/com/twitter/scalding-core_2.10/0.16.0 -SNAPSHOT / scalding-core_2.10-0.16.0-SNAPSHOT.pom [info]解析org.scala-lang #scala-compiler; 2.10.4 ... [info]解析org.scala-lang #scala-reflect; 2.10.4 ... [info]解析org.scala-lang#jline; 2.10.4 ... [info]解析org.fusesource.jansi#jansi; 1.4 ... [warn] ::::::: ::::::::::::::::::::::::::::::::::::::::::::::::: [warn] :: UNRESOLVED DEPENDENCIES :: [warn ] :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: [警告] :: com.twitter #scalding-core_2.10; 0.16.0-SNAPSHOT:not found [warn] ::::::::::::::::::::::::::::::::::::::::::: :::::::::::::::::::: [warn] [warn]注意:未解决的依赖路径:[warn] com.twitter:scalding-core_2.10:0.16.0-SNAPSHOT [警告] - myproject:myproject_2.10:0.1-SNAPSHOT [trace]抑制堆栈跟踪:为完整输出运行'last myProject /:update' . [trace]抑制堆栈跟踪:为完整输出运行'last myProject /:ssExtractDependencies' . [error](myProject /:update)sbt.ResolveException:unresolved dependency:com.twitter #scalding-core_2.10; 0.16.0-SNAPSHOT:not found [error](myProject /:ssExtractDependencies)sbt.ResolveException:unresolved dependency: com.twitter #scalding-core_2.10; 0.16.0-SNAPSHOT:未找到

回答(1)

2 years ago

烫伤publishes jars on Sonatype Maven Central,所以你真的不需要搞乱Git ProjectRef . 你只需要让你的sbt resolvers正确,这样它就可以找到 jar . 从 build.sbt 开始:

resolvers ++= Seq(
  Resolver.sonatypeRepo("releases"),
  "Concurrent Maven Repo" at "http://conjars.org/repo"
)

级联publishes to the Conjars repository而不是Central,因此您很可能需要额外的解析器,如图所示 .

最初尝试这些,如果你仍然得到未解决的错误,你可能需要添加additional repos that Scalding uses,具体取决于你需要依赖的工件 - 你可能不需要整个 scalding 超级工件,你可能会减少到 scalding-corescalding-commons ,_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _,

所以要明确,而不是 ProjectRefdependsOn scaldingCore ,添加上面的解析器,如下所示:

libraryDependencies ++= {
  val scaldingVersion = "0.16.0-RC6"

  Seq(
    "com.twitter" %% "scalding-core"    % scaldingVersion
  , "com.twitter" %% "scalding-commons" % scaldingVersion
  , "com.twitter" %% "scalding-repl"    % scaldingVersion
  )
}

等等 .