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 Summary
FieldsModifier and TypeFieldDescriptionprivate booleanWhether to fail the build if invalid exclusions is found.private org.apache.maven.project.MavenProjectprivate StringCurrent project modelId.private ResolverUtilprivate org.apache.maven.execution.MavenSessionprivate booleanSkip plugin execution completely.Fields inherited from interface org.apache.maven.plugin.Mojo
ROLE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidexecute()private Collection<org.apache.maven.model.Exclusion> getExclusionsForDependency(org.apache.maven.model.Dependency dependency) private booleanisExclusionInProject(org.apache.maven.model.Exclusion exclusion) private voidlogViolations(String name, Map<Coordinates, List<Coordinates>> violations, Consumer<String> logger) Methods inherited from class org.apache.maven.plugin.AbstractMojo
getLog, getPluginContext, setLog, setPluginContext
-
Field Details
-
project
@Component private org.apache.maven.project.MavenProject project -
resolverUtil
-
session
@Component private org.apache.maven.execution.MavenSession session -
exclusionFail
@Parameter(property="mdep.exclusion.fail", defaultValue="false") private boolean exclusionFailWhether to fail the build if invalid exclusions is found.- Since:
- 3.7.0
-
skip
@Parameter(property="mdep.skip", defaultValue="false") private boolean skipSkip plugin execution completely.- Since:
- 3.7.0
-
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)
-