Implicitly clean lib/ before running deps. Fixes #61.

This commit is contained in:
Phil Hagelberg 2010-06-21 19:19:39 -07:00
parent 607c282a0a
commit 3c86ca585c
2 changed files with 6 additions and 1 deletions

View file

@ -16,6 +16,9 @@
javax.jms/jms
com.sun.jdmk/jmxtools
com.sun.jmx/jmxri]]]
;; Before fetching dependencies, the contents of the lib/ directory
;; will get deleted unless this is set to true.
:disable-implicit-clean false
;; Dev dependencies are intended for use only during
;; development. Projects that depend on this project will not pull
;; in its dev-dependencies, and they won't be included in the uberjar.

View file

@ -2,6 +2,7 @@
"Install jars for all dependencies in lib."
(:require [lancet])
(:use [leiningen.pom :only [default-repos make-dependency]]
[leiningen.clean :only [empty-directory]]
[clojure.java.io :only [file]])
(:import [org.apache.maven.artifact.ant DependenciesTask RemoteRepository]
[org.apache.tools.ant.util FlatFileNameMapper]))
@ -45,6 +46,8 @@
"Download and install all :dependencies listed in project.clj.
With an argument it will skip development dependencies."
([project skip-dev set]
(when-not (:disable-implicit-clean project)
(empty-directory (:library-path project)))
(let [deps-task (DependenciesTask.)]
(.setBasedir lancet/ant-project (:root project))
(.setFilesetId deps-task "dependency.fileset")
@ -54,7 +57,6 @@ With an argument it will skip development dependencies."
(.addConfiguredRemoteRepository deps-task r))
(doseq [dep (project set)]
(.addDependency deps-task (make-dependency dep)))
;; TODO: this is starting a rogue thread keeping the JVM from exiting
(.execute deps-task)
(.mkdirs (file (:library-path project)))
(copy-dependencies (:jar-behavior project)