Skip to content

Instantly share code, notes, and snippets.

@MicahElliott
Created April 9, 2012 19:12
Show Gist options
  • Save MicahElliott/2345696 to your computer and use it in GitHub Desktop.
Save MicahElliott/2345696 to your computer and use it in GitHub Desktop.
Installing an unhosted jar dependency (though clojure source on github)

Installing an unhosted jar dependency (though source on github)

In this example I'm setting up doc-test with lein for a new project.

Create a new project.

% lein new my-proj
% cd my-proj

Add a convenience lein plugin to enable running doc-tests from CLI.

% lein plugin install lein-clj-doc-test "0.0.1

Add a doc-test and try running it now.

% lein doc-test
...

Now we want to be able to run doc-tests as from code as part of regular test suite. doc-test is not in clojars, so we need to install it locally.

% cd ~/tmp
% git clone https://github.com/amalloy/clj-doc-test
% cd clj-doc-test

Build it as a jar.

% lein jar

Add the localrepo lein plugin to enable local maven m2 installation.

% lein plugin install lein-localrepo "0.3"

Figure out what the incantation is for installing this jar.

% lein localrepo coords  doc-test-0.0.1-SNAPSHOT.jar
doc-test-0.0.1-SNAPSHOT.jar doc-test/doc-test 0.0.1-SNAPSHOT

Install it!

% lein localrepo install doc-test-0.0.1-SNAPSHOT.jar doc-test/doc-test 0.0.1-SNAPSHOT

Back in your project you now need to set up the dependency.

% cd .../my-proj
% $EDITOR project.clj
<add:>
:dev-dependencies ... [doc-test "0.0.1-SNAPSHOT"]

Install it to your project.

% lein deps

Add the explicit test to your code.

% $EDITOR test/my_proj/test/core.clj
<add:>
(doc-test slugify)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment