Skip to content

Commit

Permalink
Add a workaround for bug in Leiningen 1.6.2.
Browse files Browse the repository at this point in the history
  • Loading branch information
Brenton Ashworth committed Feb 3, 2012
1 parent 4ee5b7d commit 3354565
Showing 1 changed file with 32 additions and 4 deletions.
36 changes: 32 additions & 4 deletions src/leiningen/bootstrap.clj
@@ -1,10 +1,38 @@
(ns leiningen.bootstrap
"Bootstrap the project by running lein deps and lein git-deps."
(:require leiningen.deps
leiningen.git-deps))
(:use [leiningen.git-deps :only [git-deps]]
[leiningen.core :only [default-repos]]
[leiningen.deps :only [deps]]
[leiningen.util.maven :only [container make-remote-artifact
make-remote-repo make-local-repo]])
(:import (org.apache.maven.artifact.resolver ArtifactResolver)))

;; There is a bug in Leiningen 1.6.2 which requires that you have
;; Clojure 1.2.1 in the local maven repository when you are working on a
;; Clojure 1.3 project. If the first project that someone works on
;; with Leiningen is a Clojure 1.3 based project then they will
;; encounter this problem.

;; A lot of people have run into this with ClojureScript One so we
;; have added a workaround.

;; Leiningen includes an `install` task which, for some unknown reason,
;; takes a long time to run. Below, we have extracted just the part
;; of that task that we need to get a dependency from a maven repository.

(defn- standalone-download
"Download a dependency from a maven repository."
[name group version]
(.resolveAlways (.lookup container ArtifactResolver/ROLE)
(make-remote-artifact name group version)
(map make-remote-repo default-repos)
(make-local-repo)))

(defn bootstrap
"Bootstrap the project by running lein deps and lein git-deps."
[project]
(leiningen.deps/deps project)
(leiningen.git-deps/git-deps project))
;; Workarond for Leiningen 1.6.2 bug. Ensure that we have Clojure 1.2.1 in
;; the local maven repository.
(standalone-download "clojure" "org.clojure" "1.2.1")
(git-deps project)
(deps project))

0 comments on commit 3354565

Please sign in to comment.