Skip to content

Create a projectλ︎

Create a project called todo-list using Leiningen, the build automation tool for Clojure. This project will run the simplest possible webserver.

On the command line:

lein new todo-list

Leiningen - new project called todo-list

Take a look at the project structureλ︎

Change into the todo-list directory created by the Leiningen command and see the project structure that has been created.

  • project.clj - the project configuration, written in Clojure
  • src for all the source code
  • test for unit test code

Using the tree command is a simple way to see the project structure (alternatively use ls -R or a graphical file browser).

Clojure project structure - webdev

Hint:: File names and the Java class pathλ︎

The src and test directories both contain a directory named todo_list even though our project is todo-list.

Unfortunately the Java classpath does not like dashes '-' in directory or file names, so Leiningen changes the directory names to src/todo_list & test/todo_list and the initial test to src/todo_list/core_test.clj.