Write jar to the :target-path directory.

This commit is contained in:
David McNeil 2010-03-29 08:48:58 -05:00 committed by Phil Hagelberg
parent 036b47d505
commit 225d4a4ae1
3 changed files with 9 additions and 2 deletions

View file

@ -14,7 +14,7 @@ Raise an exception if any deletion fails unless silently is true."
(defn clean [project] (defn clean [project]
(println "Cleaning up") (println "Cleaning up")
(delete-file (str (:root project) "/" (:name project) ".jar") true) (delete-file (str (:target-path project) "/" (:name project) ".jar") true)
(delete-file (str (:root project) "/" (:name project) "-standalone.jar") true) (delete-file (str (:root project) "/" (:name project) "-standalone.jar") true)
(doseq [d [(:compile-path project) (doseq [d [(:compile-path project)
(:library-path project)]] (:library-path project)]]

View file

@ -28,6 +28,8 @@
(str root# "/test")) (str root# "/test"))
:resources-path (or (:resources-path m#) :resources-path (or (:resources-path m#)
(str root# "/resources")) (str root# "/resources"))
:target-path (or (:target-path m#)
(str root# "/target"))
:root root#)))) :root root#))))
(def ~(symbol (name project-name)) project))) (def ~(symbol (name project-name)) project)))

View file

@ -63,13 +63,18 @@
(doseq [filespec filespecs] (doseq [filespec filespecs]
(copy-to-jar project jar-os filespec)))) (copy-to-jar project jar-os filespec))))
(defn get-jar-filename [project jar-name]
(let [target-dir (:target-path project)]
(.mkdir (file target-dir))
(str target-dir "/" jar-name)))
(defn jar (defn jar
"Create a $PROJECT.jar file containing the compiled .class files as well as "Create a $PROJECT.jar file containing the compiled .class files as well as
the source .clj files. If project.clj contains a :main symbol, it will be used the source .clj files. If project.clj contains a :main symbol, it will be used
as the main-class for an executable jar." as the main-class for an executable jar."
([project jar-name] ([project jar-name]
(compile/compile project) (compile/compile project)
(let [jar-file (str (:root project) "/" jar-name) (let [jar-file (get-jar-filename project jar-name)
filespecs [{:type :bytes filespecs [{:type :bytes
:path (format "meta-inf/maven/%s/%s/pom.xml" :path (format "meta-inf/maven/%s/%s/pom.xml"
(:group project) (:group project)