We will detail you on how to setup Scala IDE and SBT to build a complete development environment on Cloudera VM. This setup will be helpful on self learning and prototyping your work.
Eclipse is by default available on Cloudera VM and you can find it on your desktop.
Open Eclipse and choose Help -> Eclipse Market Space -> seach for “Scala IDE” -> select and install “Scala IDE” from the list
SBT (Scala Build Tool) Setup
Visit SBT page http://www.scala-sbt.org/download.html to see how to install SBT on your Debian or RPM Linux.
SBT can be installed using below commands in Terminal window for RPM based Linux (Cloudera).
curl https://bintray.com/sbt/rpm/rpm > bintray-sbt-rpm.repo sudo mv bintray-sbt-rpm.repo /etc/yum.repos.d/ sudo yum install sbt
Enable SBT Eclipse
To make SBT compatible Eclipse IDE projects we also need to do few more steps. At the time of writing this tutorial we have use v0.13 SBT so the path below mentioned is related to that. You can change the SBT build version accordingly to follow the tutorial.
mkdir -p ~/.sbt/0.13/plugins/ touch ~/.sbt/0.13/plugins/plugins.sbt
Edit plugins.sbt file and update below sbteclipse plugin details.
vi ~/.sbt/0.13/plugins/plugins.sbt addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "5.1.0")
Use below command to download all dependencies for sbteclipse and this will take approximately 10 minutes to complete.
Build SBT compatible Eclipse Scala Project
Open Eclipse -> File -> New -> Scala Project -> Give name as “TestScalaApp”
After creating the project create build.sbt file by right click on the project and select New -> File -> name as “build.sbt” -> OK
In Terminal goto project workspace and enter sbt eclipse, By doing this will refer all sbt dependencies lib to eclipse compatible meta and IDE can ref these libraries.
cd /user/workspace/TestScalaApp sbt eclipse sbt clean compile package