A common workflow when developing a Clojure project is to leverage one or more libraries written by others. When found, you'll review the main documentation page for a library and learn the information you'll need to add to your project.clj file's
:dependencies vector so Leiningen can find and load that library. These libraries will typically come from Clojars but can also be loaded from Maven Central.
Behind the scenes, when you build your project, you should know that your configured libraries will be installed in your local Maven repository. Look inside of the
.m2 directory off of your home directory.
So far so good. This will be all you need if you are good using these libraries without modification.
The question does arise though when you want to try changing one of these libraries. How can you set things up to allow this is the question.
The first step is to clone and build the project you want to work with. Make sure you can do that. Then give this local project a new version number. Here I use a naming convention of setting the major version number to 99. This way when I reference this version in my project I have a version number that really sticks out. Also, I've got a situation where the version number only changes at the major level. I don't have to change the others. Next, run
lein install for this library. This will install the
99 version in your local
Go back to your project which uses the example project. Make sure it still builds and runs. Then, update your dependencies list and change the project library's required version number to this new
At this point you should be all set.
Each time you update the local library you will need to
lein install the project to update your local
Also, at this point you should drill into your
.m2 directory and learn where your local project is installed. The directory structure is
groupId followed by
artifactId. If your project name is a single name you'll find that the name is used for each level of the directory structure. At some point you'll need to remove the
99 version so knowing now where it is will make this simpler in the future.