Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use a local repository for a Clojure library during initial development?

I have a question about developing a Clojure library which is not answered in the suggested workflow for Library Development and Distribution as described here: http://clojure-doc.org/articles/ecosystem/libraries_authoring.html

I am developing a library and want to test this in a clojure project. In this project I will have to add the library under development as a dependency. Is there an alternative for 'lein deploy clojars' which will deploy my library to a local repository? If so how would I setup :dependencies for this in the test project? Note that I will be using libraries in clojars as well in the project which I use to test the library under development.

So where should I deploy a Clojure library in development to, a local repository perhaps, such that it can be used by projects which alpha test the library. How should the test projects address this. I would like to know how this affects 1) the project.clj file for the library development project and 2) the project.clj file for the project which tests the library in development.

like image 665
nilo de roock Avatar asked Apr 17 '16 10:04

nilo de roock


2 Answers

lein install does the job:

$ lein install -h
Install jar and pom to the local repository; typically ~/.m2.

In your library project execute lein install and your library jar and pom files will be installed under the ~/.m2 directory.

After that when you build another project that depends on your library, lein will find its binaries in ~/.m2.

~/.m2 is a default location of the local Maven repository which is one of the locations used by lein during dependency resolution. It also works as a cache for remote repositories where artifacts downloaded from Maven Central or Clojars are stored.

like image 186
Piotrek Bzdyl Avatar answered Nov 14 '22 07:11

Piotrek Bzdyl


What you are looking for is Leigningen's hard to find unless you know what to look for "checkouts" features.

Documentation: https://github.com/technomancy/leiningen/blob/master/doc/TUTORIAL.md#checkout-dependencies

like image 32
afhammad Avatar answered Nov 14 '22 06:11

afhammad