Question

Let's say I was hacking on a clojure library I was using in my project:

/User/SCdF/Code/myproject/
/User/SCdF/Code/other-peoples-projects/clojure-library-cloned-from-github

Currently, when I make changes in clojure-library-cloned-from-github I then run lein install to push my new version to the local repository (I've changed my and their project.clj to point to a newer -SNAPSHOT version of the library so it gets updated every time) and then restart / run lein deps on myproject.

Is there a way I can tell leiningen to look in ../../clojure-library-cloned-from-github for the source code for the library instead of using a maven and jars, so that when I make changes to the code they're seen at runtime?

Was it helpful?

Solution

Check out Leiningens checkout dependencies functionality.

Basically, you make a symbolic link to the library directory in a subdirectory called 'checkouts' of your current project, and add it to your Leiningen profile. Now that project is loaded too whenever your program is started from Leiningen (REPL, run).

If you are on Windows, instead of making a symbolic link, you need to make the NTFS equivalent of a symbolic link to a directory, called a 'junction point'.

Take care that this does not work if your project isn't actually started through Leiningen (for instance in Eclipse/CounterClockWise). If you run from CounterClockWise, you need to add the library you want as an Eclipse project, then edit the Eclipse project properties of your own project: Under Java Build Path > Projects, add the library project.

Now if you start from the Eclipse REPL, the library will be included to the java class path. However, if you want the project to work when run through Leiningen as well, you also need to use the checkouts functionality.

Of course, whenever you want to make a standalone build of your program, the checkouts way won't work anymore, and you need to include the library as a normal dependency, or include a built version in your uberjar.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top