Tech behind Tech

Raw information. No finesse :)

Leiningen – Adding git submodule to Leiningen project

with 4 comments


With git, sometimes it easy to use git submodule for dependency management. In Leiningen, for some reason the only “advertised” way of dependency management is using maven. After some poking around, there is a way in Leiningen to use git submodules for dependency management.

Are you ready? ( drumroll …)

It is very simple actually :)

You have to checkout your submodules to “checkouts” folder. Leiningen will automatically add your submodule’s src directory to your classpath.

That’s it folks :)

Written by Siva Jagadeesan

December 11, 2010 at 1:39 pm

Posted in Clojure

Tagged with , ,

4 Responses

Subscribe to comments with RSS.

  1. What version of Lein are you doing this with? Doesn’t seem to work with v1.3.1

    Amit

    December 11, 2010 at 11:42 pm

    • It does seem to work in v1.3.1.

      lein classpath
      /Users/admin/work/clojure/clj/src:/Users/admin/work/clojure/clj/test:/Users/admin/work/clojure/clj/classes:/Users/admin/work/clojure/clj/resources:/Users/admin/work/clojure/clj/test-resources:/Users/admin/work/clojure/clj/checkouts/leiningen/src:/Users/admin/work/clojure/clj/checkouts/leiningen/classes:/Users/admin/work/clojure/clj/checkouts/leiningen/resources:/Users/admin/work/clojure/clj/lib/clojure-1.2.0.jar:/Users/admin/work/clojure/clj/lib/clojure-contrib-1.2.0.jar:/Users/admin/work/clojure/clj-bob/lib/dev/swank-clojure-1.2.1.jar

      Siva Jagadeesan

      December 12, 2010 at 12:38 am

  2. This is a useful feature,

    but, you will need to include all of the module dependencies manually, “lein deps” will not look into submodules

    dave

    December 16, 2011 at 8:22 pm

    • however, if you add the :checkout-deps-shares option this can be resolved and you can include these dependencies

      e.g:

      :checkout-deps-shares [:source-path :test-path
      ~(fn [p] (str (:root p) “/lib/*”))]

      I am not sure, yet, as to whether this will work if you had more checkouts in a checkouts module.
      My suspicion would be no. but I have not looked.

      dave

      December 16, 2011 at 8:54 pm


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 146 other followers

%d bloggers like this: