Class SofticarDependencyValidationPlugin

java.lang.Object
com.softicar.gradle.dependency.validation.plugin.SofticarDependencyValidationPlugin
All Implemented Interfaces:
org.gradle.api.Plugin<org.gradle.api.Project>

public class SofticarDependencyValidationPlugin extends Object implements org.gradle.api.Plugin<org.gradle.api.Project>
This Gradle plug-in analyzes and validates resolved dependencies, in order to deliberately fail the build if the validation yields a negative result.

This plug-in is currently solely concerned with the validation of dependency conflict resolutions. Particularly, for any given library with at least two conflicting versions in the classpath dependencies, this plug-in ensures that the latest version (or an even newer one) among all encountered versions is used. That is, accidental downgrades, e.g. by using Gradle's "force" mechanism in a resolution strategy, are avoided.

The following table exemplifies cases in which this plug-in would (not) fail the build:

 | Classpath | Enforced | Build  |
 | Versions  | Version  | Fails  |
 +-----------+----------+--------+
 | 1.1, 1.2  | 1.1      | yes    |
 | 1.1, 1.2  | 1.2      | no     |
 | 1.1, 1.2  | 1.3      | no     |
 
The underlying assumption is that dependency downgrades are very likely to crash the dependent code, and that we hence always want to use the highest version of a dependency (among all versions transitively required by artifacts in the classpath).
  • Constructor Details

    • SofticarDependencyValidationPlugin

      public SofticarDependencyValidationPlugin()
  • Method Details

    • apply

      public void apply(org.gradle.api.Project project)
      Specified by:
      apply in interface org.gradle.api.Plugin<org.gradle.api.Project>