Adam Arold
Adam Arold

Reputation: 30578

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.

Upvotes: 2

Views: 2028

Answers (3)

Andrea Richiardi
Andrea Richiardi

Reputation: 733

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

Upvotes: 4

uvtc
uvtc

Reputation: 720

You can grab the jar yourself, manually, from http://clojars.org/repo/. Then unpack it and have a look around.

And, of course, you can go right to the source of a given lib, if you like (the Clojars page should display the url).

Incidentally though, do note that noir is deprecated, and it's recommended that you instead use Compojure + lib-noir.

Upvotes: 0

Mikita Belahlazau
Mikita Belahlazau

Reputation: 15419

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

Upvotes: 7

Related Questions