Posts

Showing posts with the label scala

Sbt template to setup scala multi-project build with dependencies

GitHub project 'sbt-multiproject-template'

Scala Option Type

The Neophyte's Guide to Scala Part 5: The Option Type by Daniel Westheide

Scala Play Framework json case class example

Notepad++ Scala syntax highlighting

Scala comes with Notepad++ plugin for syntax highlighting. To install the plugin copy SCALA_HOME/misc/scala-tool-support/notepad-plus/userDefineLang.xml file to %APPDATA%\Notepad++ folder and restart Notepad++. scala-tool-support folder contains plugins for other tools as well like textmate, emacs etc..

Play Web Framework for Scala

This is a guide how to setup version 1.2.2 that supports scala template engine. - Download play framework 1.2.2RC1 from http://www.playframework.org/download - Install scala module 'play install scala-0.9.1' ( http://scala.playframework.org/) - Create new application 'play new myapp --with scala' - Create IntelliJ IDEA module 'play idealize myapp' - Test application 'play run' and go to 'http://localhost:9000' for more info check the documentation http://scala.playframework.org/documentation/scala-0.9.1/home if you’re new to Play watch this video A web app in 10 minutes using Play framework from zenexity on Vimeo .

Add JRebel to SBT

This allows for continuous reloading when doing Lift development Download JRebel (jar installer) http://www.zeroturnaround.com/jrebel/current/ Get free JRebel license for Scala Developers http://sales.zeroturnaround.com/ After installation add this to your sbt batch and VM parameters in IntelliJ IDEA (File/Settings/SBT) set SCRIPT_DIR=%~dp0 java -Dhttp.proxyHost=<proxy-server> -Dhttp.proxyPort=<proxy-port> -Xmx512M -Drebel.license=<path-to-jrebel>/javarebel.lic -noverify -javaagent:<path-to-jrebel>/jrebel.jar -jar " %SCRIPT_DIR%sbt-launch-0.7.5.jar " %* From sbt console run  > ~prepare-webapp

Setup Lift (Scala web framework)

Create new folder 'LiftProject' Run sbt command from that folder, choose 'y' to create new project (Name: LiftProject, Organization: test) Configure Lifty ( http://lifty.github.com/) Lift SBT processor - you only need to do it once From sbt prompt run the following (including * character)   > *lifty is org.lifty lifty 1.6.1    > update Create new Lift project (when asked you can specify version 2.3 instead of 2.3-RC3)   > lifty create project-blank Create idea project files  > idea Refresh everything  > reload > update > compile Run Jetty webserver > ~jetty-run Open http://localhost:8080 and you should see your lift webpage More info about Lift http://liftweb.net/ Lift Book http://simply.liftweb.net/index.html code samples: https://github.com/dpp/simply_lift

Setup Scala with SBT in IntelliJ IDEA

Download Dependencies Download IntelliJ IDEA Community Edition (10.0.3) http://www.jetbrains.com/idea/download Download Scala http://www.scala-lang.org/downloads (2.8.1 installer) Download SBT http://code.google.com/p/simple-build-tool/ (0.7.5) Setup   Setup SBT according to this page (Launching Sbt section) http://code.google.com/p/simple-build-tool/wiki/Setup Add Scala/SBT plugins to IntelliJ IDEA Go to File/Settings/Plugins, choose Available tab, right click on Scala plugin and click on 'Download and Install'. Do the same for SBT plugin. Restart IntelliJ IDEA Go to File/Settings/SBT and set location of your SBT jar file and if you're on windows behind firewall add proxy info to vm params (-Dhttp.proxyHost=<proxy_server> -Dhttp.proxyPort=<proxy_port>) Create Project Create new Folder ScalaProject Run sbt command from that folder, choose 'y' to create new pr...