Spark GitHub Clone – Hello World Example Project
To make things simple, I have created a Spark Hello World project in GitHub, I will use this to run the example. First let’s clone the project, build, and run.
- Open IntelliJ IDEA
- Create a new project by selecting File > New > Project from Version Control.
Using this option, we are going to import the project directly from the GitHub repository.
-
Navigate to Repository URL, select the Version control as Git and enter the below Github URL for URL and enter the directory where you want to clone.
https://github.com/spark-examples/spark-hello-world-example -
If you don’t have Git installed, select the “Download and Install” option from the above window.
-
After Git installation, select the clone option which clones the project into your given folder.
-
This creates a new project on IntelliJ and starts cloning.
-
Now, wait for a few mins to complete the clone and also import the project into the workspace.
Once the cloning completes, you will see the project workspace structure on IntelliJ.
4. Run Maven build
Now run the Maven build. First, select the Maven from the right corner, navigate to Lifecycle > install, right-click, and select Run Maven Build.
This downloads all dependencies mentioned in the pom.xml file and compiles all examples in this tutorial. This also takes a few mins to complete and you should see the below message after a successful build.
5. Run Hello World Spark Program
After a successful Maven build, run src/main/scala/com.aistudylabs.spark.SparkSessionTest
In case you still get errors during the running of the Spark application, please restart the IntelliJ IDE and run the application again.
Summary
This lesson guides learners through cloning a Spark Hello World project from GitHub, setting it up in IntelliJ, running a Maven build to install dependencies, and executing a basic Spark program.
