Class AnalyzeExclusionsMojo

java.lang.Object
org.apache.maven.plugin.AbstractMojo
org.apache.maven.plugins.dependency.exclusion.AnalyzeExclusionsMojo
All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo

@Mojo(name="analyze-exclusions", requiresDependencyCollection=TEST, threadSafe=true) public class AnalyzeExclusionsMojo extends org.apache.maven.plugin.AbstractMojo
Analyzes the exclusions defined on dependencies in this project and reports if any of them are invalid.

Relevant use case is when an artifact in a later version has removed usage of a dependency, making the exclusion no longer valid.

Since:
3.7.0
  • Field Details

    • project

      @Component private org.apache.maven.project.MavenProject project
    • resolverUtil

      @Component private ResolverUtil resolverUtil
    • session

      @Component private org.apache.maven.execution.MavenSession session
    • exclusionFail

      @Parameter(property="mdep.exclusion.fail", defaultValue="false") private boolean exclusionFail
      Whether to fail the build if invalid exclusions is found.
      Since:
      3.7.0
    • skip

      @Parameter(property="mdep.skip", defaultValue="false") private boolean skip
      Skip plugin execution completely.
      Since:
      3.7.0
    • projectModelId

      private String projectModelId
      Current project modelId.
  • Constructor Details

    • AnalyzeExclusionsMojo

      public AnalyzeExclusionsMojo()
  • Method Details

    • execute

      public void execute() throws org.apache.maven.plugin.MojoExecutionException
      Throws:
      org.apache.maven.plugin.MojoExecutionException
    • getExclusionsForDependency

      private Collection<org.apache.maven.model.Exclusion> getExclusionsForDependency(org.apache.maven.model.Dependency dependency)
    • isExclusionInProject

      private boolean isExclusionInProject(org.apache.maven.model.Exclusion exclusion)
    • logViolations

      private void logViolations(String name, Map<Coordinates,List<Coordinates>> violations, Consumer<String> logger)