~severeoverfl0w/clj-classpath-duplicates

A simple CLI for showing duplicates on the classpath
~severeoverfl0w/public-todo

New ticket tracker added

1 year, 10 months ago
~severeoverfl0w/public-inbox

New mailing list added

1 year, 10 months ago

#Clojure Classpath Duplicates

A simple tool to find duplicates on the classpath for JVM programs. Not specific to Clojure, just works particularly well with it.

This will help you find when you have 2 of the same logging API on the classpath, or accidentally introduced a shaded version of a library. These sorts of problems can cause absolute chaos when it comes to understanding what's happening in your program! All sorts of mysterious bugs start happening.

#Usage

Add a dependency, then run the main in io.dominic.clj-classpath-duplicates.core. The exit code will be the number of duplicates, or 255 in the case of CLI parsing errors.

clj/deps.edn dependency information:

io.dominic/clj-classpath-duplicates {:mvn/version "0.1.1"}

Leiningen dependency information:

[io.dominic/clj-classpath-duplicates "0.1.1"]

Some paths are ignored by default. The source code is the best reference for what, but it's mostly html files, license files, etc. Anything that's normal for there to be duplicates of, I've tried to include.

#Options

Under deps.edn, paths will be shortened to their coordinate if available. Disable this using --full-path.

The sha will be displayed next to a path in order to help you determine if it's an exact duplicate (less bad, but worth fixing in case they ever go out of sync) or a distinct one (you're in trouble!). This can be hidden using --no-sha.

To supply additional paths to be ignored, use --ignore-re or --ignore. These need to match the absolute path within the classpath URL that is incorrect. For example, --ignore META-INF/LICENSE or --ignore-re '.*/LICENSE'.

There's also -h or --help to print the help out, should this README fall out of date.

#deps.edn Quick Start

$ clj -Sdeps '{:deps {io.dominic/clj-classpath-duplicates {:mvn/version "0.1.1"}}}' -A:your:aliases:here -m io.dominic.clj-classpath-duplicates.core -h

Alias (run with clj -A:classpath-duplicates, make sure it's the last alias in use).

:classpath-duplicates {:extra-deps {io.dominic/clj-classpath-duplicates {:mvn/version "0.1.1"}}
                       :main-opts ["-m" "io.dominic.clj-classpath-duplicates.core"]}