As I mentioned, I am going through Functional Programming in Java. I have a couple of github sub-repos for it. I am going through the Java code, and then re-implementing it in Groovy and Clojure. The Java and Groovy parts are here inside a repo called “my_groovy_apps_001”, and the Clojure part is here inside a repo called “clojure_apps”.
I started doing the Clojure inside the Gradle app inside “my_groovy_apps_001” using the Neptune Gradle plugin for Clojure. It was okay, but I could not get the REPL to work, and I could not figure out how to run only some of the tests.
So I decided this might be a good time to learn Clojure Boot, the new build tool that is an alternative to Leiningen and seems to be gaining some momentum.
Frankly, the docs are terrible. You kind of need the docs to do anything since it doesn’t do a lot out of the box, kind of like Eclipse when it was first released. Until plug-ins were developed, Eclipse was not very useful, and Boot seems the same to me at this point. Boot doesn’t even have a way to run tests out of the box.
One reason I think the docs are terrible is that in the “Getting Started” section on the Boot github page, they redirect you to a ClojureScript tutorial, telling you that it is “an excellent introduction to Boot and ClojureScript”.
I really have no interest in ClojureScript at this time. I do not like Javascript, and while I have heard great things about ClojureScript and its creators/maintainers, I want to avoid the JavaScript swamp as much as possible. As the guy who wrote the Pollen DSL for Racket put it, Lisp makes me smarter, and pretty much any language ending in *Script seems to kill brain cells on contact. The fact that there are so many languages that compile to JavaScript to me is not a good sign for JavaScript. It says to me that people deal with JavaScript because they have to, not because they want to. And that people will go to great lengths to avoid dealing with JavaScript directly. And since the JavaScript community keeps spawning new frameworks all the time, I think on some level they agree. I am sure at some point I will have to learn about ClojureScript, but I would like to put that off for now.
But it’s not just me being anti-anythingScript here. I like the Unix philosophy of a tool does one thing and does it well. I want to learn about Boot. Not ClojureScript. I don’t want to wade through a tutorial for a dessert topping to find the bits about the floor wax.
So I did some searching for some blog posts about how to get started with Boot. I found some by a guy named Sean Cornfield (whom I actually met at ClojureConj). He developed a plug-in called boot-new that pretty much does everything you need to get started using Boot. I would argue that you don’t even need a tutorial for Boot. Just use boot-new.
All you have to do is install Boot, and then run this command:
boot -d boot/new new -t app -n myapp
It will fetch boot-new from Clojars (I assume) and make a project called myapp.
One of the things that boot-new allows you to do is to run tests for specific namespaces. You can run just one:
boot test --namespaces info.shelfunit.funcjava.chap01-test
or multiple namespaces separated by commas:
boot test --namespaces myapp.core-test,serpent-talk.talk-test
With “–namespaces”, you specify the namespace of the tests. To specify the namespace of the function, use –include:
boot test --include serpent-talk.talk
So if anyone in your local Clojure group wants a presentation on Boot, you can just tell them to look at boot-new. It would be the shortest presentation ever.
I don’t know how to do all the things that Leiningen does, but if you just want to start a project, compile it, run a REPL, run some tests and get a JAR, I think boot-new covers some of the basics. Correctly or incorrectly, it seems like a lot of people (including me) think of Boot as an alternative to Leiningen. So my approach is basically, “I know how to do X in Leiningen, how do I do that in Boot?”
For a lot of basic tasks, boot-new is your answer.
You’re welcome.
Image from Gospel Lectionary, an 11th century manuscript housed at Bavarian State Library, webpage information here, image from World Document Library, image assumed allowed under Fair Use.