technomancy/leiningen — Issue #307: When installing a lein plugin dependencies are not included
Author: ogf
Created: 2011-10-31 16:23:50+00:00
State: open

Using Leiningen 1.6.1.1 on Java 1.6.0_22 OpenJDK Client VM, installed using lein self install script on Ubuntu 11.04.

$ lein plugin install lein-difftest 1.3.3
Copying 6 files to /tmp/lein-13a77e3a-79b9-4b33-b091-34e13e74cdf3/lib/dev
Including lein-difftest-1.3.3.jar
Created lein-difftest-1.3.3.jar
$ ls .lein/plugins
lein-difftest-1.3.3.jar
**No other jars present. Are the dependencies included in the jar?**
$ unzip -l .lein/plugins/lein-difftest-1.3.3.jar

> Archive: .lein/plugins/lein-difftest-1.3.3.jar
> Length Date Time Name
> --------- ---------- ----- ----
> 74 2011-05-23 14:59 META-INF/MANIFEST.MF
> 2537 2011-05-23 14:59 META-INF/maven/lein-difftest/lein-difftest/pom.xml
> 102 2011-05-23 14:59 META-INF/maven/lein-difftest/lein-difftest/pom.properties
> 456 2011-05-23 14:49 project.clj
> 3884 2010-09-29 00:11 difftest/core.clj
> 832 2010-09-28 13:07 leiningen/hooks/difftest.clj

**It doesn't seem so. Does lein-difftest really have dependencies?**
$ unzip -c .lein/plugins/lein-difftest-1.3.3.jar project.clj
Archive: .lein/plugins/lein-difftest-1.3.3.jar
inflating: project.clj
(defproject lein-difftest "1.3.3"
:description "Run tests, display better test results."
:dependencies [[org.clojure/clojure "1.2.0"]
[org.clojure/clojure-contrib "1.2.0"]
[difform "1.1.1"]
[clj-stacktrace "0.2.0" :exclusions [org.clojure/clojure]]
[clansi "1.0.0" :exclusions [org.clojure/clojure]]]
....
**Yes**
**Add hook to init.clj: (require 'leiningen.hooks.difftest)**
**The dependencies are not found at runtime:**

$lein test

>Exception in thread "main" java.io.FileNotFoundException: Could not locate clansi__init.class or clansi.clj on classpath (core.clj:9)
>	at clojure.lang.Compiler.eval(Compiler.java:5440)
>	at clojure.lang.Compiler.eval(Compiler.java:5415)
>	at clojure.lang.Compiler.load(Compiler.java:5857)
>	....
>Caused by: java.io.FileNotFoundException: Could not locate clansi__init.class or clansi.clj on classpath:
>	at clojure.lang.RT.load(RT.java:412)
>	at clojure.lang.RT.load(RT.java:381)
>	at clojure.core$load$fn__4511.invoke(core.clj:4905)
> ....

**Note: Using :dev-dependencies approach it works**