Skip to content

Instantly share code, notes, and snippets.

@MalloZup
Created July 11, 2019 11:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MalloZup/9cdb0ae5ca0906bd9f3d6240cd41bc01 to your computer and use it in GitHub Desktop.
Save MalloZup/9cdb0ae5ca0906bd9f3d6240cd41bc01 to your computer and use it in GitHub Desktop.
use local-jars with clojure lein

Rationale:

This is a quick guide for using local jars in #clojure.

create project with lein

lein new foo
cd foo

Say I have a random JAR file that is not available in any repository:

touch README.md
jar cf bar.jar README.md
mkdir repo

mvn deploy:deploy-file -DgroupId=local -DartifactId=bar \
  -Dversion=1.0.0 -Dpackaging=jar -Dfile=bar.jar \
  -Durl=file:repo
  
  And I write my project.clj like this:

(defproject foo "0.1.0-SNAPSHOT"
  :dependencies [[org.clojure/clojure "1.4.0"]
                 [local/bar "1.0.0"]]
  :repositories {"project" "file:repo"})

test with:

lein deps

References:

  1. historic one: https://gist.github.com/stuartsierra/3062743

  2. an example: https://github.com/thehammer/jukebox2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment