对象spark不是包org的成员

对象spark不是包org的成员

问题描述:

在Eclipse Scala-IDE中导入以下内容

When importing the following in Eclipse Scala-IDE

import org.apache.spark.SparkContext
import org.apache.spark.SparkContext._

我收到此错误:对象spark不是org软件包的成员

我安装了sbt-0.13.9.msi

I installed the sbt-0.13.9.msi

我还应该做什么?

build.sbt

build.sbt

name := "scala-spark-app"

version := "1.0"

scalaVersion := "2.10.4"

libraryDependencies += "org.apache.spark" %% "spark-core" % "1.5.2"

我在IntelliJ上收到了相同的编译错误(在Mac上),而 sbt compile 成功执行了.以下步骤解决了我的问题:

I was receiving the same compilation error (on my Mac) with IntelliJ whereas sbt compile executed successfully. The following steps solved my problem:

  1. 清洁sbt
  2. sbt gen-idea (用于重建IntelliJ项目文件)
  3. 退出并重新启动IntelliJ
  1. sbt clean
  2. sbt gen-idea (to rebuild IntelliJ project files)
  3. quit and restart IntelliJ

我希望这会有所帮助.