Permalink
Browse files

add proxy support

Parse http_proxy environment variable to setup aether/pomegranate proxy config.
  • Loading branch information...
1 parent 9d046a8 commit 18362faf8a03a56ce88e7320c01a3fba57e3128f @juergenhoetzel juergenhoetzel committed Apr 4, 2012
Showing with 13 additions and 4 deletions.
  1. +1 −1 leiningen-core/project.clj
  2. +11 −2 leiningen-core/src/leiningen/core/classpath.clj
  3. +1 −1 project.clj
View
2 leiningen-core/project.clj
@@ -7,7 +7,7 @@
[classlojure "0.6.5"]
[robert/hooke "1.1.2"]
[ordered "1.1.0"]
- [com.cemerick/pomegranate "0.0.9"
+ [com.cemerick/pomegranate "0.0.10"
:exclusions [org.slf4j/slf4j-api]]]
:dev-resources-path "dev-resources"
:profiles {:dev {:resource-paths ["dev-resources"]}})
View
13 leiningen-core/src/leiningen/core/classpath.clj
@@ -5,7 +5,8 @@
[clojure.java.io :as io]
[leiningen.core.user :as user])
(:import (java.util.jar JarFile)
- (java.util.regex Pattern)))
+ (java.util.regex Pattern)
+ (java.net URL)))
;; Basically just for re-throwing a more comprehensible error.
(defn- read-dependency-project [root dep]
@@ -76,6 +77,13 @@
(defn add-auth [repositories]
(map add-repo-auth repositories))
+(defn get-proxy-settings
+ "Returns a map of the JVM proxy settings"
+ []
+ (when-let [uri (URL. (System/getenv "http_proxy"))]
+ {:host (.getHost uri)
+ :port (.getPort uri)}))
+
(defn- get-dependencies
[dependencies-key {:keys [repositories native-path] :as project}
& {:keys [add-classpath?]}]
@@ -87,7 +95,8 @@
:offline? (:offline project)
:repositories (add-auth repositories)
:coordinates (project dependencies-key)
- :transfer-listener :stdout))
+ :transfer-listener :stdout
+ :proxy (get-proxy-settings)))
(defn resolve-dependencies
"Simply delegate regular dependencies to pomegranate. This will
View
2 project.clj
@@ -6,7 +6,7 @@
:url "https://github.com/technomancy/leiningen"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
- :dependencies [[leiningen-core "2.0.0-preview2"]
+ :dependencies [[leiningen-core "2.0.0-SNAPSHOT"]
[clucy "0.2.3"]
[useful "0.7.6-alpha1"]
[lein-newnew "0.2.5"]

0 comments on commit 18362fa

Please sign in to comment.