Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
79 lines (52 sloc) 3.8 KB
layout title description date author keywords categories
Hack a Scala/Play build on Snap CI
In this post, I will talk about how to set up a build for simple Scala/Play project on Snap CI.
Shishir Das
snap ci, continuous delivery, continuous integration, developer tools, github, Scala, java, deployments, java builds, ruby, rails, github
java scala play deployments

Typically, we do not claim to offer first class support for a language/framework on Snap unless we provide some basic heuristics to help users set up their builds. Based on this defintion, Snap currently supports Ruby, Rails & Java builds. However, Snap can run builds for any JVM based language. In this post, I will talk about how to set up a build for simple Scala/Play project.

If you have your own project on GitHub you can use that. You would need to add sbt-laucher to your project if not present and a script to invoke it. This might look something like

>> curl -LO
>> echo 'java -Xms512M -Xmx1536M -Xss1M -XX:+CMSClassUnloadingEnabled -XX:MaxPermSize=384M -jar `dirname $0`/sbt-launch.jar "$@"' > sbt
>> chmod u+x sbt

For those you don't have a scala/play project you can follow the following instructions.

NB: Tricking Snap into believing you are running a Java project

Since Scala is not yet a language which has first class support- by our original definition, you can trick Snap into thinking that it is working with a Java project by adding an empty pom.xml or build.xml file to your project root. Now, with the tricking behind us, we can proceed to run our sbt build as follows.

Project Set Up.

You can find the instructions to setup a Play Todolist project here. After you have successfully created the project, you need to add sbt-launcher(v0.12.4) to the root of the project project.

>> cd ~/projects/todolist
(todolist) >> curl -LO

Create script to invoke sbt-laucher in PROJECT_ROOT.

(todolist) >> echo 'java -Xms512M -Xmx1536M -Xss1M -XX:+CMSClassUnloadingEnabled -XX:MaxPermSize=384M -jar `dirname $0`/sbt-launch.jar "$@"' > sbt
(todolist) >> chmod u+x sbt

Run test on local machine.

(todolist) >> ./sbt clean test

##Add the project to github

Create a repository on Github named todolist and push local todolist repository to github

(todolist) >> git init .
(todolist) >> git add .
(todolist) >> git commit -m "first commit"
(todolist) >> git remote add origin<<your_github_id>>/todolist.git
(todolist) >> git push -u origin master
Setup build for todolist project on Snap

Login to Snap and add "todolist" project. Snap will try to detect the framework and fail, you would see a warning stating "Manually Configure a project"

Click "+ADD NEW". And select "Custom Stage" (Ignore the Ruby version drop down ;))

Enter "Build" in "STAGE NAME" and "./sbt clean test" in "Tasks to be executed".

Click "Create Project"

That’s all there is to it. Snap will now monitor your repository and run builds for all commits. Snap has a lot more to offer from CCTray, HipChat and Campfire build notifications to manual gated deployments to production environments. Also, we’re just getting warmed up. If there’s a feature you’d like to see or if you just want to say hi feel free to [contact us]({{ }}).

Snap CI © 2017, ThoughtWorks