scalacenter / classpath-shrinker   0.1.1

Apache License 2.0 GitHub

Scalac plugin to detect classpath entries that aren't directly used

Scala versions: 2.12 2.11

Classpath Shrinker

Build Status Maven Central

(This project is completed and currently not maintained by anyone)

The Classpath Shrinker is a scalac plugin to detect unused classpath entries. It was originally created by Jason Zaugg as a better alternative to a commit which fulfilled the same functionality but required the instrumentation of symbol initializers.

This plugin is now maintained by the Scala Center.

The creation of this plugin was motivated by SCP-009: Improve direct dependency experience, and complements the improvements to stub error messages available in 2.12.2 and 2.11.9.

If you use Pants or Bazel, you may find this compiler plugin useful.

Add to your project

resolvers += Resolver.bintrayRepo("scalacenter", "releases")
addCompilerPlugin("ch.epfl.scala" %% "classpath-shrinker" % "0.1.1")

Once it's added, it will report if there are unused classpath entries automatically.

Output looks like:

[info] Compiling 1 Scala source to /drone/src/github.com/scalacenter/classpath-shrinker/example/target/scala-2.12/classes...
[warn] Detected the following unused classpath entries: 
[warn] /.coursier-cache/https/repo1.maven.org/maven2/com/google/guava/guava/21.0/guava-21.0.jar
[warn] one warning found