Create a $PROJECT-$VERSION.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 as the main-class for an executable jar.
(defn jar
"Create a $PROJECT-$VERSION.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 as the main-class for an executable jar."
([project jar-name]
(binding [compile/*silently* true]
(compile/compile project))
(let [jar-path (get-jar-filename project jar-name)
filespecs [{:type :bytes
:path (format "meta-inf/maven/%s/%s/pom.xml"
(:group project)
(:name project))
:bytes (make-pom project)}
{:type :bytes
:path (format "meta-inf/maven/%s/%s/pom.properties"
(:group project)
(:name project))
:bytes (make-pom-properties project)}
(when (and (:resources-path project)
(.exists (file (:resources-path project))))
{:type :path :path (:resources-path project)})
{:type :path :path (:compile-path project)}
{:type :path :path (:source-path project)}
{:type :path :path (str (:root project) "/project.clj")}]]
(write-jar project jar-path filespecs)
(println "Created" jar-path)
jar-path))
([project] (jar project (get-default-jar-name project))))
Comments top
No comments for jar. Log in to add a comment.