Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


lein javac includes leiningen's jar in the classpath - dependencies conflict #809

smee opened this Issue · 1 comment

3 participants


Running lein javac -verbose in a project with java source files I see that the classpath contains the file ~/.lein/self-installs/leiningen-2.0.0-preview10-standalone.jar.


git clone git:// 
cd pdf-index 
lein javac

should result in a clean compilation, but instead several errors are reported.

This results stems from clashes between different versions of Apache Lucene. Pdf-index uses Lucene 2.2 (another version than within leiningen itself), but javac picks up Lucene classes not from the dependency of the project but from leiningen.

Is this correct behaviour? How can I resolve this conflict?


This is indeed not correct behaviour, and seems to happen because leiningen is strapped into java through the bootclasspath. As such, the classpath will automatically be populated by the leiningen standalone when ToolProvider returns the system java compiler.

To fix this one have to run the compilation phase within a subprocess - I've issued a pull request which solves this issue, at least on Linux.

@technomancy technomancy closed this issue from a commit
@hyPiRion hyPiRion Make javac run in a subprocess. Fixes #809.
If we're not making javac run in a subprocess, libraries the project
depends on which leiningen has another version of will clash. This is
because leiningen append its standalone to java's bootclasspath, which
makes the ToolProvider add these classpaths automatically into the java
compiler it returns. By starting a subprocess without leiningen added to
the bootclasspath, we avoid this library clashing.

UI changes as a result of this patch: Whenever javac fails, the task one
wanted to run will be responsible for aborting Leiningen, whereas javac
did this itself when it discovered that the compilation failed. As we're
running in a subprocess, an abort message such as

    Uberjar aborting because jar/compilation failed: Subprocess failed

will appear, though this will only be appended to the javac error
message and the "Compilation of Java sources (lein javac) failed."

This commit also adds the overhead of starting a subprocess when one
have to compile java sources, but it will not start one if no
.class-files are outdated/not existing.

Not tested on Windows.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.