【问题标题】:Spark: sbt - dependency errorSpark:sbt - 依赖错误
【发布时间】:2017-10-20 00:12:42
【问题描述】:

我正在尝试基于 Hortonworks 教程创建一个新的 Spark 应用程序。但是当我尝试导入必要的模块时,build.sbt 不断抛出以下错误。

我安装了 SCALA - 2.11.4 和 SBT 0.13。有什么帮助吗??

Error:Error while importing SBT project:<br/>...<br/><pre>[warn]    ::::::::::::::::::::::::::::::::::::::::::::::
[warn]
[warn]  Note: Unresolved dependencies path:
[warn]      org.scala-lang:scala-library:2.11.4 ((sbt.Classpaths) Defaults.scala#L1340)
[warn]        +- sparktutorialscala:sparktutorialscala_2.11:1.0
[warn]      org.apache.spark:spark-core_2.11:2.1.0 (C:\Users\USERNAME\IdeaProjects\HelloWorld\build.sbt#L7-13)
[warn]        +- sparktutorialscala:sparktutorialscala_2.11:1.0
[warn]      org.scala-lang:scala-compiler:2.11.4
[warn]        +- sparktutorialscala:sparktutorialscala_2.11:1.0
[trace] Stack trace suppressed: run 'last *:ssExtractDependencies' for the full output.
[trace] Stack trace suppressed: run 'last *:update' for the full output.
[error] (*:ssExtractDependencies) sbt.ResolveException: unresolved dependency: org.scala-lang#scala-library;2.11.4: not found
[error] unresolved dependency: org.apache.spark#spark-core_2.11;2.1.0: not found
[error] unresolved dependency: org.scala-lang#scala-compiler;2.11.4: not found
[error] (*:update) sbt.ResolveException: unresolved dependency: org.scala-lang#scala-library;2.11.4: not found
[error] unresolved dependency: org.apache.spark#spark-core_2.11;2.1.0: not found
[error] unresolved dependency: org.scala-lang#scala-compiler;2.11.4: not found
[error] Total time: 66 s, completed 17-Oct-2017 10:49:23
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=384M; support was removed in 8.0
Picked up _JAVA_OPTIONS: -Djava.net.preferIPv4Stack=true</pre><br/>See complete 

build.sbt

name := "sparkTutorialScala"

version := "1.0"

scalaVersion := "2.11.4"

libraryDependencies ++= {
  val sparkVer = "2.1.0"
  Seq(
    "org.apache.spark" %% "spark-core" % sparkVer % "provided" withSources()
  )
}

更新错误信息:

  [error] unresolved dependency: org.apache.spark#spark-core_2.11;2.2.0: public: unable to get resource for org/apache/spark#spark-core_2.11;2.2.0: res=https://repo1.maven.org/maven2/org/apache/spark/spark-core_2.11/2.2.0/spark-core_2.11-2.2.0.pom: java.net.ConnectException: Failed to connect to repo1.maven.org/151.101.60.209:443
[error] unresolved dependency: org.scala-lang#scala-compiler;2.11.8: public: unable to get resource for org/scala-lang#scala-compiler;2.11.8: res=https://repo1.maven.org/maven2/org/scala-lang/scala-compiler/2.11.8/scala-compiler-2.11.8.pom: java.net.ConnectException: Failed to connect to repo1.maven.org/151.101.60.209:443
[error] (*:ssExtractDependencies) sbt.librarymanagement.ResolveException: unresolved dependency: org.scala-lang#scala-library;2.11.8: public: unable to get resource for org/scala-lang#scala-library;2.11.8: res=https://repo1.maven.org/maven2/org/scala-lang/scala-library/2.11.8/scala-library-2.11.8.pom: java.net.ConnectException: Failed to connect to repo1.maven.org/151.101.60.209:443
[error] unresolved dependency: org.apache.spark#spark-core_2.11;2.2.0: public: unable to get resource for org/apache/spark#spark-core_2.11;2.2.0: res=https://repo1.maven.org/maven2/org/apache/spark/spark-core_2.11/2.2.0/spark-core_2.11-2.2.0.pom: java.net.ConnectException: Failed to connect to repo1.maven.org/151.101.60.209:443
[error] unresolved dependency: org.scala-lang#scala-compiler;2.11.8: public: unable to get resource for org/scala-lang#scala-compiler;2.11.8: res=https://repo1.maven.org/maven2/org/scala-lang/scala-compiler/2.11.8/scala-compiler-2.11.8.pom: java.net.ConnectException: Failed to connect to repo1.maven.org/151.101.60.209:443
[error] Total time: 9 s, completed 19-Oct-2017 15:11:47
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=384M; support was removed in 8.0
Picked up _JAVA_OPTIONS: -Djava.net.preferIPv4Stack=true</pre><br/>See complete log in <a href="file:/C:/Users/

【问题讨论】:

  • 请显示你的 sbt 文件
  • @yehor 请检查我为 SBT 编辑的帖子
  • 您确定要向我们展示您在项目中的所有内容吗?查看错误:unresolved dependency: org.apache.spark#spark-core_2.11_2.11;2.1.0: not found 其中_2.11 重复了两次(!)
  • 您能否将scalaVersion := "2.11.4" 改为使用2.11.8val sparkVer = "2.1.0" 改为使用2.2.0?你在代理后面吗?请安装最新的 sbt 1.0.2。
  • @Jacek,我做了同样的事情,但它仍然失败。是的,我在代理后面,我已经在 IntelliJ 中适当地设置了代理。

标签: scala apache-spark intellij-idea sbt hortonworks-sandbox


【解决方案1】:

嗯,SBT 1.0 与我使用的 IDEAJ 插件或 spark 版本不兼容。安装 SBT 0.13 而不是最新版本解决了这个问题。

【讨论】:

    猜你喜欢
    • 2014-12-13
    • 2018-04-10
    • 2015-02-10
    • 2020-01-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多