Permalink
Browse files

Get list of jars in a compatible way; check :target-path.

  • Loading branch information...
1 parent 1eb28a8 commit 931c276ae94d91d94bac6b5b217861392082b7ad @technomancy committed Mar 8, 2012
Showing with 13 additions and 9 deletions.
  1. +11 −7 src/leiningen/ring/uberwar.clj
  2. +2 −2 src/leiningen/ring/war.clj
@@ -7,13 +7,17 @@
(or (:uberjar-name project)
(str (:name project) "-" (:version project) "-standalone.war")))
+(defn get-classpath [project]
+ (if-let [get-cp (resolve 'leiningen.core.classpath/get-classpath)]
+ (get-cp project)
+ (->> (:library-path project) io/file .listFiles (map str))))
+
(defn jar-dependencies [project]
- (->> (:library-path project)
- (io/file)
- (.listFiles)
- (filter #(.endsWith (str %) ".jar"))
- ;; Servlet container will have it's own servlet-api implementation
- (remove #(.startsWith (.getName %) "servlet-api-"))))
+ (for [file (get-classpath project)
+ :when (and (.endsWith file ".jar")
+ ;; Servlet container will have it's own servlet-api impl
+ (not (.startsWith file "servlet-api-")))]
+ (io/file file)))
(defn jar-entries [war project]
(doseq [jar-file (jar-dependencies project)]
@@ -29,7 +33,7 @@
(doseq [path (concat [(:source-path project)] (:source-paths project)
[(:resources-path project)] (:resource-paths project))
:when path]
- (dir-entry war-stream project "WEB-INF/classes/" path))
+ (war/dir-entry war-stream project "WEB-INF/classes/" path))
(war/dir-entry war-stream project "" (war/war-resources-path project))
(jar-entries war-stream project)))
@@ -15,7 +15,7 @@
(str (:name project) "-" (:version project) ".war")))
(defn war-file-path [project war-name]
- (let [target-dir (:target-dir project)]
+ (let [target-dir (or (:target-dir project) (:target-path project))]
(.mkdirs (io/file target-dir))
(str target-dir "/" war-name)))
@@ -175,7 +175,7 @@
(defn in-war-path [war-path root file]
(str war-path
- (-> (.toURI (io/file root))
+ (-> (.toURI (io/file root))
(.relativize (.toURI file))
(.getPath))))

0 comments on commit 931c276

Please sign in to comment.