Creating a Project
Create a new project directory structure like this:
In the top-level myproject directory, create a file named pom.xml, and copy the template below. Replace the bold-face parts with your own domain name, project name, URL, and description.
You can also replace the license name/url with a different license if you wish.
To start a Clojure REPL (read-eval-print-loop) in your new project, type:
To start a SWANK server (for connecting to Emacs SLIME), type:
Then run M-x slime-connect from within Emacs
Adding Your Own Code
Add your .clj source files under src/main/clojure. When creating file names from namespace names, periods become directory separators and hyphens become underscores. So a namespace like
Would go in the file src/main/clojure/com/example/foo_library.clj
Follow the same convention for test source code (using clojure.test), adding files under src/test/clojure.
Open-source Java libraries can be found on search engines such as MVNrepository and Jarvana. Many Clojure libraries can be found on Clojars.
Once you have found a dependency, add its group/artifact/version information to the <dependencies> section of pom.xml.
For example, to add a dependency on Compojure, add the following code to pom.xml:
Note: Be aware that different libraries may be written for different version of Clojure. Check the library documentation to make sure you have the right version.
Using Different Clojure Versions
To use the 1.2.0 development snapshots of Clojure and clojure-contrib, change this block in pom.xml: