From 3360ad4e0bca595fdbe13a703864c02ff2068556 Mon Sep 17 00:00:00 2001 From: Matt Revelle Date: Mon, 21 Dec 2009 16:19:31 -0500 Subject: [PATCH] Added documentation about :exclusions in :dependencies to the README and deps docstring. --- README.md | 10 ++++++++++ src/leiningen/deps.clj | 13 +++++++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 2a019dd3..b33bc9c7 100644 --- a/README.md +++ b/README.md @@ -112,6 +112,16 @@ Other keys accepted: Alternatively you can install into your local repository in ~/.m2 with Maven for Java libs or "lein install" for Clojure libs. +**Q:** Is it possible to exclude indirect dependencies? +**A:** Yes. Some libraries, such as log4j, depend on projects that are + not included in public repositories and unnecessary for basic + functionality. Projects listed as :dependencies may exclude + any of their dependencies by using the :exclusions key, as demonstrated here: + \[log4j "1.2.15" :exclusions \[javax.mail/mail + javax.jms/jms + com.sun.jdmk/jmxtools + com.sun.jmx/jmxri\]\] + **Q:** How should I pick my version numbers? **A:** Use [semantic versioning](http://semver.org). diff --git a/src/leiningen/deps.clj b/src/leiningen/deps.clj index cb589740..e67da3bd 100644 --- a/src/leiningen/deps.clj +++ b/src/leiningen/deps.clj @@ -30,10 +30,19 @@ (defn deps "Download and install all :dependencies listed in project.clj into the lib/ -directory. With an argument it will skip develpment dependencies. Dependencies +directory. With an argument it will skip development dependencies. Dependencies should be a vector of entries specifying group, name, and version like the following: - [org.clojure/clojure-contrib \"1.0-SNAPSHOT\"]" + [org.clojure/clojure-contrib \"1.0-SNAPSHOT\"] + +It is also possible to exclude specific indirect dependencies of a direct +dependency using the optional :exclusions keyword and vector of entries. +A project that depends on log4j could exclude unnecessary indirect +dependencies with the following: + [log4j \"1.2.15\" :exclusions [javax.mail/mail + javax.jms/jms + com.sun.jdmk/jmxtools + com.sun.jmx/jmxri]]" ([project skip-dev] (let [deps-task (DependenciesTask.)] (.setBasedir lancet/ant-project (:root project))