Liking cljdoc? Tell your friends :D

lein-classpath-jar

A Leiningen plugin to work around long-classpath issues on Windows.

Background

Most Clojure tooling, including lein, run programs by constructing a big classpath out of the dependency tree and then passing that as a command-line argument to java.

On Windows this can be problematic when the classpath is very long, since the length of Windows command-line arguments is extremely constrained when compare to most Unix-based OSes. Depending on various factors, the maximum length can range from 8191 characters to 32K characters, but even 32K may not be enough for some applications with a large dependency tree.

The usual solution to this problem for JVM-based Windows development is to create a "pathing jar" - that is, a jar which only contains a Manifest that points to the various jar files that make up the entire classpath of the program. Java can then be invoked via java -cp pathing.jar clojure.main and the resulting JVM will have the proper classpath.

More information can be found in this tools.deps.alpha ticket.

What this plugin does

This leiningen plugin borrows an idea from tools.deps.alpha - whenever a classpath is generated by leiningen, we compute its MD5 hash and generate a pathing jar file based on that hash. Then we return the location of the jar file, rather than the concatenated list of every jar file actually on the path.

As a bonus, the generated files are compatible with the Windows tools.deps implementation.

Usage

This is intended to work as a user-level plugin. To use it, add this to the :plugins vector of your :user profile:

{:user {:plugins [[lein-classpath-jar "0.1.0"]]}}

License

Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.

Can you improve this documentation?Edit on GitHub

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close