How to create maven project for Spark and Scala in Scala IDE
2 min readApr 30, 2018
Spark is a very good framework to play with big data. You can quickly download and install spark on your computer or laptop and you can start coding in spark shell but it is a bit tedious to create project in Eclipse , IntelliJ IDEA or Scala IDE.
So, I am going to tell you that how to create your first maven project in Scala IDE where you can code in spark and scala. Please follow below steps to create your first project.
- Download Scala IDE from link — http://scala-ide.org/download/sdk.html
- Extract it and open Scala IDE like you open eclipse
- Once the Scala IDE is opened then start creating first maven project. To create first project ,please follow below steps carefully.
- Click on File -> New -> Project ->Maven -> Maven Project ->next
- Check option — Create a simple project(skip archetype selection) and click on next
- Provide group Id(ex-com.spark.scala) and artifact Id(ex- demo) and click on finish.
- Expand your project(Demo) and open pom.xml and add dependency from link —( https://github.com/Manojd664/Spark-ML/blob/master/pom.xml ) after line — <version>0.0.1-SNAPSHOT</version> in pom.xml, now save the pom.xml
- After saving pom.xml , It will build the project. After build completion, you will see some errors in problems panel. To remove these errors — Right click on errors -> click on Quick Fix -> click on finish
- Now, Right click on project(Demo) -> Click on configure -> click on add scala nature
- Again you will some list of errors in problems panel. To remove these erros — Right click on project(Demo) -> select “scala compiler” -> check “Use project settings” ->From scala installation ,select scala version -> click on apply and close
- Right click on project(Demo) -> Build Path ->Configure Build Path ->From top of panel , select “libraries” ->Select “Scala library container” ->click on remove -> Apply and close
- Expand project — Right click on src/main/java and rename it to src/main/scala
- Right click on src/main/scala and create package with package name= group Id.artifact Id(ex-com.spark.scala.demo)
- Right click on package(com.spark.scala.demo) and create a scala object and start with coding by creating spark session.
- You can see code for your first project from link — https://github.com/Manojd664/Spark-Scala/blob/master/src/main/scala/com/spark/scala/learnscala/wordcount/WordCount.scala
I hope this will help you. Please feel free to comment suggestion to improve it.