Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I make Leiningen download the source of a required library?

I think there is some option in the project.clj but I did not find it in the documentation of Leiningen.

For example i have this project.clj

(defproject test-app "0.1.0-SNAPSHOT"
            :dependencies [[org.clojure/clojure "1.4.0"]
                           [noir "1.3.0-beta3"]]

How can I make Leiningen download the source of noir? I just have the binaries now.

like image 993
Adam Arold Avatar asked Jan 27 '26 04:01

Adam Arold


2 Answers

noir consists of clj files and they are themselves sources. So retrieve jar: $HOME/.m2/repository/noir/noir/1.3.0-beta3/noir-1.3.0-beta3.jar, unpack it and check. You also can check sources of methods in REPL using source method.
If you need sources of java libs then you may have problems. I'm not sure lein supports downloading of sources out of the box. If you need to download sources of java libs then you can use maven:

  1. Generate pom file: lein pom
  2. Download source via mvn dependency:sources: Get source JARs from Maven repository
  3. Sources will be downloaded to your local maven repo under $HOME/.m2/repository
like image 155
Mikita Belahlazau Avatar answered Jan 30 '26 16:01

Mikita Belahlazau


I found a leiningen plugin called ubersource very handy.

Just add it to your project.clj:

:plugins [[lein-cljsbuild "1.0.1"]
          [lein-ubersource "0.1.1"]]

and then call: lein ubersource

like image 35
Andrea Richiardi Avatar answered Jan 30 '26 18:01

Andrea Richiardi