For the latest version please go to the book's repo.
This repo was just use while the archetype was in development, but all subsequent changes and bug fixes went to the official book's repo.
Not up to date:
Since IntelliJ IDEA doesn't distinguish between archetype catalog and archetype repository when you try to add remote archetype, you should first use interactive or batch mode (see below) in terminal to generate a new project then import it in Idea as existing maven project.
File > New > Project... > Maven > Maven Project
- Click
Next
on the first screen of the New project wizard - Select
Configure... > Add Remote Catalog...
- Enter the following URL in the
Catalog file
field: https://github.com/mbonaci/spark-archetype-scala/raw/master/archetype-catalog.xml
EnterSpark Scala Archetype
in theDescription
field - After you close the dialog, choose the
Spark Scala Archetype
catalog in theCatalog
dropdown list - In the next dialog enter you project details and confirm with
Finish
- Once the new projects generates change the Scala version to 2.10.5 by right-clicking on the generated project's root and selecting:
Scala > Set the Scala Installation > Fixed Scala Installation 2.10.5.(bundled)
- From the terminal (interactive mode):
mvn archetype:generate \
-DarchetypeCatalog=https://github.com/mbonaci/spark-archetype-scala/raw/master/archetype-catalog.xml \
-DarchetypeRepository=https://github.com/mbonaci/spark-archetype-scala/raw/master
- From the terminal or a shell script (batch mode):
mvn archetype:generate -B \
-DarchetypeCatalog=https://github.com/mbonaci/spark-archetype-scala/raw/master/archetype-catalog.xml \
-DarchetypeRepository=https://github.com/mbonaci/spark-archetype-scala/raw/master \
-DarchetypeGroupId=org.sia \
-DarchetypeArtifactId=spark-archetype-scala \
-DarchetypeVersion=0.9 \
-DgroupId=com.company -DartifactId=project -Dversion=0.1-SNAPSHOT -Dpackage=com.company
For your convenience, here's the copy/paste friendly version (customize your new project by changing the last 4 params):
mvn archetype:generate -B -DarchetypeCatalog=https://github.com/mbonaci/spark-archetype-scala/raw/master/archetype-catalog.xml -DarchetypeRepository=https://github.com/mbonaci/spark-archetype-scala/raw/master -DarchetypeGroupId=org.sia -DarchetypeArtifactId=spark-archetype-scala -DarchetypeVersion=0.9 -DgroupId=org.sijaset -DartifactId=sija -Dversion=0.1 -Dpackage=org.sijaset
- Generated project example usage (run
mvn scala:help
for the full list of commands):
You can run the generated project by simply doing Shift+Alt+x s
(while positioned in App.scala
), which is the shortcut for Run As > Scala Application
.
You can also run it from the command line or from Eclipse Maven Run configuration with these goals:
mvn scala:compile
mvn scala:run -DmainClass=com.company.App
Have fun :)