Error running sbt package: no apache in org pkg

I’m having issues when running sbt package in my project. The errors I’m receiving are:

  1. object apache is not a member of package org
  2. not found: value SparkSession

My Spark version is 2.4.4, my Scala version is 2.11.12, and the contents of my build.sbt file are as follows:

name := "simpleApp"

version := "1.0"

scalaVersion := "2.11.12"

//libraryDependencies += "org.apache.spark" %% "spark-core" % "2.4.4"


  libraryDependencies ++= {
   val sparkVersion = "2.4.4"
       Seq( "org.apache.spark" %% "spark-core" % sparkVersion)
  }

The project consists of a Scala file, demoapp.scala, with the following contents:

import org.apache.spark.sql.SparkSession
object demoapp {
  def main(args: Array[String]) {

val logfile = "C:/TEST/demo/hello.txt"
val spark = SparkSession.builder.appName("Simple App in Scala").getOrCreate()
val logData = spark.read.textFile(logfile).cache()
val numAs = logData.filter(line => line.contains("Washington")).count()
println(s"Lines are: $numAs")
spark.stop()
}
}

I’m using Spark version 2.4.4 and Scala version 2.11.12. When I run sbt package I’m receiving the following errors:

  • object apache is not a member of package org
  • not found: value SparkSession

My build.sbt file contains the following:

name := "simpleApp"

version := "1.0"

scalaVersion := "2.11.12"

//libraryDependencies += "org.apache.spark" %% "spark-core" % "2.4.4"


  libraryDependencies ++= {
   val sparkVersion = "2.4.4"
       Seq( "org.apache.spark" %% "spark-core" % sparkVersion)
  }

My project consists of a Scala file, demoapp.scala, with the following contents:

import org.apache.spark.sql.SparkSession
object demoapp {
  def main(args: Array[String]) {

val logfile = "C:/TEST/demo/hello.txt"
val spark = SparkSession.builder.appName("Simple App in Scala").getOrCreate()
val logData = spark.read.textFile(logfile).cache()
val numAs = logData.filter(line => line.contains("Washington")).count()
println(s"Lines are: $numAs")
spark.stop()
}
}

I’m having issues when running sbt package in my project. The errors I’m receiving are:

  • object apache is not a member of package org
  • not found: value SparkSession