• (jar project jar-name)
  • (jar project)
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.

0 Examples top

Log in to add / edit an example.

See Also top

Log in to add a see also.

Plus_12x12 Minus_12x12 Source leiningen/jar.clj:74 top

(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))))
Vars in leiningen.jar/jar: binding defn let println
Used in 0 other vars

Comments top

No comments for jar. Log in to add a comment.