Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added main class to jar manifest for ring jar

  • Loading branch information...
commit 4829842d6ffb90cbf1465e5bbe2817979f25b983 1 parent d47f48f
James Reeves authored
Showing with 12 additions and 3 deletions.
  1. +12 −3 src/leiningen/ring/jar.clj
15 src/leiningen/ring/jar.clj
View
@@ -1,7 +1,8 @@
(ns leiningen.ring.jar
- (:use [leiningen.ring.util :refer (compile-form ensure-handler-set!)])
(:require [leiningen.jar :as jar]
- [leiningen.ring.server :as server]))
+ [clojure.string :as str])
+ (:use [leiningen.ring.util :only (compile-form ensure-handler-set!)]
+ [leiningen.ring.server :only (add-server-dep)]))
(defn default-main-namespace [project]
(let [handler-sym (get-in project [:ring :handler])]
@@ -21,8 +22,16 @@
(ring.server.leiningen/serve
'~(select-keys project [:ring])))))))
+(defn update-project [project func & args]
+ (vary-meta
+ (apply func project args)
+ update-in [:without-profiles] #(apply func % args)))
+
+(defn add-main-class [project]
+ (update-project project assoc :main (symbol (main-namespace project))))
+
(defn jar [project]
(ensure-handler-set! project)
- (let [project (server/add-server-dep project)]
+ (let [project (-> project add-server-dep add-main-class)]
(compile-main project)
(jar/jar project)))
Please sign in to comment.
Something went wrong with that request. Please try again.