1. Install Java 8
If you forget to do this you will probably see all sorts of unexplained bugs.
2. Download the Intellij IDE
https://www.jetbrains.com/idea/download/
or the scala-ide based on Eclipse
http://scala-ide.org
Check out the plugins for Intellij
https://www.jetbrains.com/idea/plugins/
Install the JetBrains official Scala plugin
3. Create a directory structure (optionally first create your revision control repo structure and cd to it e.g. git...) using this handy script which has some optional sections commented out.
http://alvinalexander.com/sbtmkdirs
http://grosdim.blogspot.com/2013/01/quick-sbt-tutorial.html
http://www.scala-sbt.org/0.13/tutorial/index.html
4. Optionally install sbteclipse so you can generate an eclipse project if you use scala-ide
https://github.com/typesafehub/sbteclipse/
https://github.com/typesafehub/sbteclipse/wiki/Installing-sbteclipse
If you forget to do this you will probably see all sorts of unexplained bugs.
2. Download the Intellij IDE
https://www.jetbrains.com/idea/download/
or the scala-ide based on Eclipse
http://scala-ide.org
Check out the plugins for Intellij
https://www.jetbrains.com/idea/plugins/
Install the JetBrains official Scala plugin
3. Create a directory structure (optionally first create your revision control repo structure and cd to it e.g. git...) using this handy script which has some optional sections commented out.
http://alvinalexander.com/sbtmkdirs
http://grosdim.blogspot.com/2013/01/quick-sbt-tutorial.html
http://www.scala-sbt.org/0.13/tutorial/index.html
4. Optionally install sbteclipse so you can generate an eclipse project if you use scala-ide
https://github.com/typesafehub/sbteclipse/
https://github.com/typesafehub/sbteclipse/wiki/Installing-sbteclipse
emacs ~/.sbt/0.13/plugins/plugins.sbt
(~/.sbt/0.13/plugins probably does not exist and either use emacs to make it or mkdir ~/.sbt/0.13/plugins and then use your favorite editor)
add
addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "2.5.0")
"After adding the sbteclipse plugin like this, you should either start sbt or, if it was already started, reload the current session by executing the reload command. If everything worked, you should have the new command eclipse available. Now read on about how to use sbteclipse."
$ sbt
Use of ~/.sbtconfig is deprecated, please migrate global settings to /usr/local/etc/sbtopts
[info] Loading global plugins from /Users/depappas/.sbt/0.13/plugins
[info] Updating {file:/Users/depappas/.sbt/0.13/plugins/}global-plugins...
[info] Resolving org.fusesource.jansi#jansi;1.4 ...
[info] downloading https://repo.typesafe.com/typesafe/ivy-releases/com.typesafe.sbteclipse/sbteclipse-plugin/scala_2.10/sbt_0.13/2.5.0/jars/sbteclipse-plugin.jar ...
[info] [SUCCESSFUL ] com.typesafe.sbteclipse#sbteclipse-plugin;2.5.0!sbteclipse-plugin.jar (1808ms)
[info] downloading https://repo.typesafe.com/typesafe/ivy-releases/com.typesafe.sbteclipse/sbteclipse-core/scala_2.10/sbt_0.13/2.5.0/jars/sbteclipse-core.jar ...
[info] [SUCCESSFUL ] com.typesafe.sbteclipse#sbteclipse-core;2.5.0!sbteclipse-core.jar (2512ms)
[info] Done updating.
[info] Set current project to html_product_website_generator (in build file:/Users/depappas/scala_test/html_product_website_generator/)
> eclipse
[info] About to create Eclipse project files for your project(s).
[info] Updating {file:/Users/depappas/scala_test/html_product_website_generator/}html_product_website_generator...
[info] Resolving org.fusesource.jansi#jansi;1.4 ...
[info] Done updating.
[info] Successfully created Eclipse project files for project(s):
[info] html_product_website_generator
>
5. Configure scala-ide
http://scala-ide.org/docs/user/gettingstarted.html
5. Open up the set project in Intellij
File->Open
select the project
Or in Eclipse
Once you have installed and generated the Eclipse project files using one of the above plug-ins, start Eclipse. Use
File → Import → General/Existing Project into Workspace
. Select the directory containing your project as root directory
, select the project and hit Finish
. And Voila.
6. If you want to use scala.xml and get compile errors try this:
Add this line to the build.sbt file
libraryDependencies += "org.scala-lang.modules" % "scala-xml_2.11" % "1.0.5"
$ sbt
> update
> eclipse
Go to Eclipse and refresh the project
The compile errors in Eclipse should be gone.
If you get this error:
UNRESOLVED DEPENDENCIES ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: org.scala-lang#scala-library;2.11.7 : not found
Then find the right scala.xml version:
Lets find the right version of the scala.xml to add to the build.sb file.
Now lets add it to the build.sbt file.
Lets check in the cache dir: ~/.ivy2/cache
for the missing libs