Search code examples
clojureleiningencompojurering

ring/compojure without jetty


I know it's possible to create a war file using lein ring war, but it seems to still include jetty dependencies. Is there a way to exclude the jetty dependencies when I'm building the war (and deploying on tomcat)?

If I can't does this matter at all or is it just extra jars/class files that are packaged up into the war but never actually used?


Solution

  • Leinigen supports :exclusions in a dependency.

    (defproject my-project "1.0.0"
         :dependencies [[org.clojure/clojure "1.2.0"]
                        [org.clojure/clojure-contrib "1.2.0"]]
         :dev-dependencies [[autodoc "0.7.1" :exclusions [org.apache.ant/ant]]])
    

    See here for details.

    Often the problem is working out where the dependencies are coming from. In maven you can do this:

    mvn dependency:tree 
    

    to get a useful ASCII art representation of the dependency tree.

    One option would be to generate a pom.xml for your project using

    lein pom
    

    Then runing maven over that.