sbt build使用xgboost的spark scala失败了

时间:2017-05-16 19:58:19

标签: scala apache-spark sbt xgboost

./ build / sbt clean package 给出以下错误:

Resolving org.fusesource.jansi#jansi;1.4 ...
   [warn]   ::::::::::::::::::::::::::::::::::::::::::::::
   [warn]   ::          UNRESOLVED DEPENDENCIES         ::
   [warn]   ::::::::::::::::::::::::::::::::::::::::::::::
   [warn]   :: ml.dmlc.xgboost#xgboost4j_2.10;0.7: not found
   [warn]   :: ml.dmlc.xgboost#xgboost4j-spark_2.10;0.7: not found
   [warn]   ::::::::::::::::::::::::::::::::::::::::::::::

build.sbt如下所示:

name := "xgboostproj"
version := "1.0"
libraryDependencies += "org.apache.spark" %% "spark-core" % "1.6.1"
libraryDependencies += "org.apache.spark" %% "spark-mllib" % "1.6.1"
resolvers += Resolver.mavenLocal
libraryDependencies += "ml.dmlc.xgboost" %% "xgboost4j" % "0.7"
libraryDependencies += "ml.dmlc.xgboost" %% "xgboost4j-spark" % "0.7"

提前致谢!

2 个答案:

答案 0 :(得分:2)

xgboost jars必须在本地构建并发布到您当地的maven存储库,以便您的设置正常工作。相关说明已发布here

此外,依赖关系应如下所示(groupId为ml.dmlc)

libraryDependencies += "ml.dmlc" %% "xgboost4j" % "0.7"
libraryDependencies += "ml.dmlc" %% "xgboost4j-spark" % "0.7"

答案 1 :(得分:0)

我认为依赖项应该更改为:

libraryDependencies += "ml.dmlc" % "xgboost4j" % "0.7"
libraryDependencies += "ml.dmlc" % "xgboost4j-spark" % "0.7"

还要确保你的sbt正在查看当地的maven repo。这是我需要修复的两件事,以使其工作。还要确保m2 repo中存在jar文件。这假设您使用mvn install来构建jvm包。