brew install coursier/formulas/coursier && cs setup
curl -fL https://github.com/coursier/launchers/raw/master/cs-x86_64-pc-linux.gz | gzip -d > cs && chmod +x cs && ./cs setup
https://github.com/coursier/launchers/raw/master/cs-x86_64-pc-win32.zip
Install:
cs java --jvm 11 --setup
** JAVA_HOME will locate at **
cs java --jvm 11 --env
Windows: %LOCALAPPDATA%\Coursier\Cache\jvm, typically looking like C:\Users\Alex\AppData\Local\Coursier\Cache\jvm
sbt new scala/scala3.g8
Download and install IntelliJ Community Edition Install the Scala plugin by following the instructions on how to install IntelliJ plugins Open the build.sbt file then choose Open as a project
Download VSCode Install the Metals extension from the Marketplace Next, open the directory containing a build.sbt file (this should be the directory hello-world if you followed the previous instructions). When prompted to do so, select Import build.
val sparkVersion = "3.3.1"
libraryDependencies ++= Seq(
("org.apache.spark" %% "spark-core" % sparkVersion),
("org.apache.spark" %% "spark-sql" % sparkVersion),
("org.apache.spark" %% "spark-streaming" % sparkVersion),
("org.apache.spark" %% "spark-streaming-kafka-0-10" % sparkVersion),
("org.apache.spark" %% "spark-sql-kafka-0-10" % sparkVersion)
).map(_.cross(CrossVersion.for3Use2_13))
import org.apache.spark.sql.SparkSession
@main def helloSpark() = {
val spark = SparkSession.builder().appName("helloSpark").master("local[*]").getOrCreate()
spark.sparkContext.setLogLevel("WARN")
spark.read.text("build.sbt").show()
}
sbt "runMain helloSpark"