Skip to content

Simple and experimental Gradle plugin to detect potential classpath collisions between library jars

License

Notifications You must be signed in to change notification settings

jimshowalter/classpath-collision-detector

This branch is 27 commits behind REPLicated/classpath-collision-detector:master.

Repository files navigation

Download

Gradle Classpath Collision Detector

Experimental Gradle plugin to detect potential classpath collisions between library jars.

Fails the build whenever an unexpected duplicate entry is found in more than one artifact.

Usage

The plugin requires Gradle 6.6 or newer.

You can either apply the plugin with the plugins block

plugins {
	id "io.fuchs.gradle.classpath-collision-detector" version "0.3"
}

or using the legacy version

buildscript {
	repositories {
		maven {
			url "https://plugins.gradle.org/m2/"
		}
	}
	dependencies {
		classpath "io.fuchs.gradle.classpath-collision-detector:classpath-collision-detector:0.3"
	}
}

apply plugin: "io.fuchs.gradle.classpath-collision-detector"

Then run ./gradlew detectCollisions to run the detection.

If the projet also applies the java plugin the task searches the runtimeClasspath for collisions.

Customization

You can also explicitly specify the configuration

tasks.named('detectCollisions', DetectCollisionsTask).configure {
	configurations.from(project.configurations.runtimeClasspath)
}

To ignore certain conflicts you can add exclude patterns that match collisions you are not interrested in e.g.

tasks.named('detectCollisions', DetectCollisionsTask).configure {
	collisionFilter {
		exclude('**.html', '**.txt', '**.properties')
	}
}

About

Simple and experimental Gradle plugin to detect potential classpath collisions between library jars

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Kotlin 93.2%
  • Nix 6.8%