Is it possible to have leiningen pull a project directly from a git repository (on github) as a dependency?
Using Bundler with Ruby, it is possible to map a gem to a git repo, allowing for rapid development and integration of dependent projects.
Update
Based on the accepted answer, there is now a leiningen plugin for managing git-deps:
https://github.com/tobyhede/lein-git-deps
Answer for 2017: Use lein-voom
You can use lein-voom to pull and build project dependencies from GitHub or other Git repositories. It works by letting you annotate your dependence vector-pair entries with voom-specific meta data. Here's an example from the README:
^{:voom {:repo "https://github.com/ring-clojure/ring" :branch "1.3"}}
[ring/ring-core "1.3.0-RC1-20140519_142204-gaf0379b"]
The main use case given for voom is allowing teams that maintain multiple Clojure projects in separate Git repositories to easily depend on the current version of one or more of the projects from another without having to constantly deploy development snapshot releases.
I prefer lein-voom over lein-git-deps (the plugin recommended in the previously-accepted answer from 2012) for a few reasons:
The fact that the specification is given through meta-data makes this plugin more flexible and easily extensible. It already has an option for specifying a specific branch/tag of the repository. You could add other key/value pairs to the map for additional fine-grained control without too much work.
You can simply delete the meta-data from your dependence entry for stable releases; i.e., there's no need to move entries around / refactor your project.clj
once your dependence moves from GitHub into Clojars.
At the time of writing (November 2017), lein-voom has been updated in the past couple of months, whereas lein-git-deps has been stagnant for 4 years.
I just found this in clojurescriptone's project.clj
I think it maybe helpful to you:
:git-dependencies [["https://github.com/clojure/clojurescript.git"
"886d8dc81812962d30a741d6d05ce9d90975160f"]
["https://github.com/levand/domina.git"
"8933b2d12c44832c9bfaecf457a1bc5db251a774"]]
The file is here.
Leiningen won't do the pulling for you (edit: not out of the box, anyway; following the lead from Sunng's answer leads one to discover that a plugin has been written for this -- see also my comment on that answer; checkout deps remain a good, built-in solution), but you can have checkouts of other projects put on the classpath. This functionality is described in the FAQ section of the README; here's the relevant Q&A:
Q: I want to hack two projects in parallel, but it's annoying to
switch between them.
A: If you create a directory called checkouts
in
your project root and symlink some other project roots into it,
Leiningen will allow you to hack on them in parallel. That means
changes in the dependency will be visible in the main project without
having to go through the whole
install/switch-projects/deps/restart-repl cycle, and the copy in
checkouts
will take precedence over the dependency declared in
project.clj. Note that this is not a replacement for listing the
project in :dependencies
; it simply supplements that for convenience.