简体   繁体   English

对象spark不是包org的成员

[英]Object spark is not a member of package org

When importing the following in Eclipse Scala-IDE 在Eclipse Scala-IDE中导入以下内容时

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

I get this error: Object spark is not a member of package org 我收到此错误: Object spark is not a member of package org

I installed the sbt-0.13.9.msi 我安装了sbt-0.13.9.msi

What else should I do? 我还该怎么办?

build.sbt build.sbt

name := "scala-spark-app"

version := "1.0"

scalaVersion := "2.10.4"

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

I was receiving the same compilation error (on my Mac) with IntelliJ whereas sbt compile executed successfully. 我在IntelliJ上收到了相同的编译错误(在我的Mac上),而sbt compile执行成功。 The following steps solved my problem: 以下步骤解决了我的问题:

  1. sbt clean 干净
  2. sbt gen-idea (to rebuild IntelliJ project files) sbt gen-idea (重建IntelliJ项目文件)
  3. quit and restart IntelliJ 退出并重启IntelliJ

I hope this helps. 我希望这有帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM