Skip to content

Commit

Permalink
Make uberjar create a $PROJECT-standalone.jar file.
Browse files Browse the repository at this point in the history
  • Loading branch information
technomancy committed Nov 21, 2009
1 parent 547e448 commit ab37c75
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 19 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -6,3 +6,4 @@ leiningen.jar
pom-generated.xml
pom.xml
Manifest.txt
lein-swank/lein-swank.jar
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -26,7 +26,7 @@ rather than copying and pasting among each of your projects.

## Installation

1. Download the script: http://github.com/technomancy/leiningen/raw/master/bin/lein
1. Download the script: http://github.com/technomancy/leiningen/raw/stable/bin/lein
2. Place it on your path and chmod it to be executable.
3. Run: <tt>lein self-install</tt>

Expand Down
4 changes: 2 additions & 2 deletions bin/lein
Expand Up @@ -9,8 +9,8 @@ LEIN_JAR=$HOME/.m2/repository/leiningen/leiningen/$VERSION/leiningen-$VERSION.ja
# this needs to exist before the JVM is launched apparently
mkdir -p classes

# If we are not running from a checkout
if [ ! -r "bin/lein" ]; then
# If we are not running from a compiled checkout
if [ ! -r "classes/leiningen/core.class" -a ! -r "lib/clojure*jar" ]; then
if [ ! -r "$LEIN_JAR" -a "$1" != "self-install" ]; then
echo "Leiningen is not installed. Please run \"lein self-install\"."
exit 1
Expand Down
31 changes: 16 additions & 15 deletions src/leiningen/jar.clj
Expand Up @@ -15,18 +15,19 @@
"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
as the main-class for an executable jar."
[project & args]
(compile/compile project)
(pom "pom-generated.xml" true)
(let [jar-file (str (:root project) "/" (:name project) ".jar")
filesets [{:dir *compile-path*}
{:dir (str (:root project) "/src")}
;; TODO: place in META-INF/maven/$groupId/$artifactId/pom.xml
;; TODO: pom.properties
{:file (str (:root project) "/pom-generated.xml")}
{:file (str (:root project) "/project.clj")}]]
;; TODO: support slim, etc
(apply lancet/jar {:jarfile jar-file
:manifest (make-manifest project)}
(map lancet/fileset filesets))
jar-file))
([project jar-name]
(compile/compile project)
(pom "pom-generated.xml" true)
(let [jar-file (str (:root project) "/" jar-name)
filesets [{:dir *compile-path*}
{:dir (str (:root project) "/src")}
;; TODO: place in META-INF/maven/$groupId/$artifactId/pom.xml
;; TODO: pom.properties
{:file (str (:root project) "/pom-generated.xml")}
{:file (str (:root project) "/project.clj")}]]
;; TODO: support slim, etc
(apply lancet/jar {:jarfile jar-file
:manifest (make-manifest project)}
(map lancet/fileset filesets))
jar-file))
([project] (jar project (str (:name project) ".jar"))))
2 changes: 1 addition & 1 deletion src/leiningen/uberjar.clj
Expand Up @@ -25,4 +25,4 @@ the dependency jars. Suitable for standalone distribution."
:when (.endsWith (.getName dep) ".jar")]
(println "Unpacking" (.getName dep))
(unzip dep *compile-path*))
(jar project))
(jar project (str (:name project) "-standalone.jar")))

0 comments on commit ab37c75

Please sign in to comment.