IntelliJ is very versatile, and offers many options that are not explored in this guide. Instead, this guide focuses on the bare minimum that is needed to get started.
Prepare your environment
This guide assumes that you have IntelliJ installed, and have a copy of the source code available locally. Additionally, a Java Development Kit (version 8) should be installed.
Start by creating a new, empty workspace.
Create a project and import the source code
The Spark source code is using an Apache Maven project structure. As IntelliJ recognizes this structure, importing the source code into an IntelliJ project is very easy.
Select the 'import' option. This will quickly import the Spark source code into a new IntelliJ project.
Using the 'import' option, select the directory in which the Spark source code is stored. Select the Maven project file (pom.xml).
IntelliJ will automatically recognize and process the Maven structure of Spark, as soon as it is pointed to the correct directory. In most cases, You can accept the defaults on the following screens of the import wizard.
Once the import wizard has been closed, the IntelliJ workspace will show. There are menu bars to the left and right edge. Left edge, click "Project" to extend Project tree. On the right, click "Maven Project" to extend Modules. That's it! You're ready to start working on the code now!
Run Spark from IntelliJ
When developing, it is often useful to run the code straight from your IDE. The following will explain how you can start a Spark instance from the code that is in the IntelliJ workspace.
The 'spark-core' module contains a class named
Startup (in the
package) that can be used to start Spark. Find the class in the Project Explorer, and open its context
menu (right-click on the file). In that menu, use the 'Run Startup.main()' option. IntelliJ wil start
to build Spark from the source code, after which Spark itself is started. If everything goes well, you will
see the Spark login screen within a matter of seconds!