Chapter 8. Organizing and Building Clojure Projects
Ironically, one of the most challenging aspects of adopting a new, promising programming language often has little to do with the language itself: you need to organize and build the codebase you’ve written in that new language into artifacts that can be distributed and used, either by other programmers as libraries, by end users, or installed into, for example, server environments as is done for web applications. The specifics of this challenge can vary greatly depending upon whether you’re using the new language as part of an existing project or in an entirely new effort, and what your specific deployment requirements are.
It’s impossible for us to cover all the ways in which you can organize your projects and redistribute the fruits of your Clojure labors, and differences of opinion in some of these areas can often outstrip their importance, but it is incumbent upon us to set you on a good path that is in accordance with the typical approaches in the Clojure community. In this chapter, we’ll give you some general hints on how to think about structuring Clojure codebases, and present the best ways to solve the build problem for Clojure projects using the two most popular build tools in the Clojure community, Leiningen and Maven.
Before getting into the mechanics of builds, we first need to establish how to organize your Clojure projects with regard to the physical placement of files as well as the functional ...