Building Clojure projects on Snap
23 September 2014
Guy Steele once joked that about the Java language that
Clojure might well be the completion of that journey.
We have had many people ask us about getting their Clojure builds running on Snap. Many others have just hacked around and found that while we don’t make a song and dance about it, it was possible to build your Clojure projects on Snap. Now we are not a song-and-dance kind of people (well, not all of us anyway ;) However, given how much we love the language, and based on how many people have asked us the question, we thought it best to document how to get your Clojure projects building on Snap.
As an example in this case, I will pick the popular Midje testing library and see how to build it on Snap. I have forked it under my account in Github.
Click on the “+ Repository” link and pick a repository. In this case, I am going to pick my fork of the Midje repository.
Snap realizes that this project is already configured with a build on Travis, and so picks up the command you specified in your travis.yml file.
In this case, we need a small change due to two things
- Our lein executable is just called lein- not lein2
- We do not support the travis syntax for testing against multiple versions of the language
Once the changes are made, your build should look something like this.
I have also gone and selected the version of Java I want to use explicitly. 1.8 in this case.
Having made these changes, I now save the build configuration. Snap kicks off the first build and you can watch the logs tail in your browser.
In a minute or two, the build completes and you can see the test results.
Of course, this is just the start. You can use Snap to extend your build in a lot of different directions from here. You can pack and release the jars. If you were building an application, you can configure deployments following the initial stage. See the What’s next section of our documentation for details on some of these!
Note: The first build usually runs slightly longer as it needs to download all dependent jars from either maven-central or clojars. These jars are automatically cached and subsequent runs will run much faster!
comments powered by Disqus