shogidude avatar

Clojure: lein build tool

shogidude

Published: 10 Jun 2020 › Updated: 10 Jun 2020Clojure: lein build tool

Clojure: lein build tool

Clojure is my favorite computer programming language. It mingles old-time elegance of Lisp with new VM platforms and modern concurrency designs. Lots of programmers stress syntax or language building features or functional development as their reasons for loving Clojure, but to me it's the rainbow parens.

Just kidding, ... Clojure supports concurrency better than any language I've seen.

Clojure runs on the JVM, .NET, and JavaScript's VMs. That's a lot of choices. I'm kind of a traditional programmer, so I stick with the JVM for most of my Clojure programming.

To get started, all you need is a plain text editor, the JDK, and a build tool. I always recommend Visual Studio Code for the text editor. Any of the commonly available open source JDKs will work. Technically, you don't even need the build tool, but why make life harder than you need to?

There are two commonly used build tools for Clojure: Boot for Clojure, and Leiningen for Clojure. Without getting into a religious war over which is better, I suggest looking into both. I, however, use Leiningen AKA 'lein'. I believe Lein is older and used by more devs than Boot, but mainly I already know Lein so I stick with it.

Lein is self installing, meaning, get the BAT or script for your OS and run it once from your system path. Lein takes care of upgrading and installing itself. Couldn't be easier.

Next create a project from a template. The command is 'lein new <template name> <project name>'. Most commonly, the 'app' template is used. When 'app' is the template, create a new project with the following command.

lein new app my-project-name

You will find the main *.clj source file in 'src/clj/my_project_name/core.clj'. To run the project in dev mode, use the command 'lein run'.

I hope to go more into project structures and templates in another post. This should get you started, if you are looking to learn Clojure.

Leave Clojure: lein build tool to:

Written by

Read more #clojure posts


Best Posts From shogidude

We have not curated any of shogidude's posts yet. But you can encourage our curation team to review posts by visiting them regularly and by referring other readers. Because we give priority to frequently read content.

More Posts From shogidude