Package org.basepom.mojo.duplicatefinder
Class DuplicateFinderMojo
- java.lang.Object
-
- org.apache.maven.plugin.AbstractMojo
-
- org.basepom.mojo.duplicatefinder.DuplicateFinderMojo
-
- All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled,org.apache.maven.plugin.Mojo
@Mojo(name="check", requiresProject=true, threadSafe=true, defaultPhase=VERIFY, requiresDependencyResolution=TEST) public final class DuplicateFinderMojo extends org.apache.maven.plugin.AbstractMojoFinds duplicate classes/resources on the classpath.
-
-
Field Summary
Fields Modifier and Type Field Description protected StringbootClasspathPropertySystem property that contains the boot class path.protected booleancheckCompileClasspathCheck resources and classes on the compile class path.protected booleancheckRuntimeClasspathCheck resources and classes on the runtime class path.protected booleancheckTestClasspathCheck resources and classes on the test class path.protected ConflictingDependency[]conflictingDependenciesArtifacts with expected and resolved versions that are checked.protected booleanfailBuildInCaseOfConflictFail the build if any files with the same name are found.protected booleanfailBuildInCaseOfDifferentContentConflictFail the build if files with the same name but different content are detected.protected booleanfailBuildInCaseOfEqualContentConflictFail the build if files with the same name and the same content are detected.protected String[]ignoredClassPatternsIgnored classes, which are not checked for multiple occurences.protected MavenCoordinates[]ignoredDependenciesDependencies that should not be checked at all.protected String[]ignoredResourcePatternsIgnored resources, which are not checked for multiple occurences.protected booleanincludeBootClasspathInclude the boot class path in duplicate detection.protected booleanincludePomProjectsInclude POM projects in validation.protected booleanpreferLocalWhether existing local directories with classes or existing artifacts are preferred.protected booleanprintEqualFilesReport files that have the same sha256 has value.protected booleanquietQuiets the plugin (report only errors).protected FileresultFileOutput file for the result of the plugin.protected intresultFileMinClasspathCountMinimum occurences on the class path to be listed in the result file.protected booleanskipSkips the plugin execution.protected booleanuseDefaultClassIgnoreListUse the default class ignore list.protected booleanuseDefaultResourceIgnoreListUse the default resource ignore list.protected booleanuseResultFileWrite result to output file.
-
Constructor Summary
Constructors Constructor Description DuplicateFinderMojo()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidexecute()voidsetIgnoredDependencies(org.apache.maven.model.Dependency[] dependencies)voidsetLog(org.apache.maven.plugin.logging.Log log)
-
-
-
Field Detail
-
printEqualFiles
@Parameter(defaultValue="false", property="duplicate-finder.printEqualFiles") protected boolean printEqualFilesReport files that have the same sha256 has value.- Since:
- 1.0.6
-
failBuildInCaseOfDifferentContentConflict
@Parameter(defaultValue="false", property="duplicate-finder.failBuildInCaseOfDifferentContentConflict") protected boolean failBuildInCaseOfDifferentContentConflictFail the build if files with the same name but different content are detected.- Since:
- 1.0.3
-
failBuildInCaseOfEqualContentConflict
@Parameter(defaultValue="false", property="duplicate-finder.failBuildInCaseOfEqualContentConflict") protected boolean failBuildInCaseOfEqualContentConflictFail the build if files with the same name and the same content are detected.- Since:
- 1.0.3
-
failBuildInCaseOfConflict
@Parameter(defaultValue="false", property="duplicate-finder.failBuildInCaseOfConflict") protected boolean failBuildInCaseOfConflictFail the build if any files with the same name are found.
-
useDefaultResourceIgnoreList
@Parameter(defaultValue="true", property="duplicate-finder.useDefaultResourceIgnoreList") protected boolean useDefaultResourceIgnoreListUse the default resource ignore list.
-
useDefaultClassIgnoreList
@Parameter(defaultValue="true", property="duplicate-finder.useDefaultClassIgnoreList") protected boolean useDefaultClassIgnoreListUse the default class ignore list.- Since:
- 1.2.1
-
ignoredResourcePatterns
@Parameter protected String[] ignoredResourcePatterns
Ignored resources, which are not checked for multiple occurences.
-
ignoredClassPatterns
@Parameter protected String[] ignoredClassPatterns
Ignored classes, which are not checked for multiple occurences.- Since:
- 1.2.1
-
conflictingDependencies
@Parameter(alias="exceptions") protected ConflictingDependency[] conflictingDependencies
Artifacts with expected and resolved versions that are checked.
-
ignoredDependencies
@Parameter(alias="ignoredDependencies") protected MavenCoordinates[] ignoredDependencies
Dependencies that should not be checked at all.
-
checkCompileClasspath
@Parameter(defaultValue="true", property="duplicate-finder.checkCompileClasspath") protected boolean checkCompileClasspathCheck resources and classes on the compile class path.
-
checkRuntimeClasspath
@Parameter(defaultValue="true", property="duplicate-finder.checkRuntimeClasspath") protected boolean checkRuntimeClasspathCheck resources and classes on the runtime class path.
-
checkTestClasspath
@Parameter(defaultValue="true", property="duplicate-finder.checkTestClasspath") protected boolean checkTestClasspathCheck resources and classes on the test class path.
-
skip
@Parameter(defaultValue="false", property="duplicate-finder.skip") protected boolean skipSkips the plugin execution.
-
quiet
@Parameter(defaultValue="false", property="duplicate-finder.quiet") protected boolean quietQuiets the plugin (report only errors).- Since:
- 1.1.0
-
preferLocal
@Parameter(defaultValue="true", property="duplicate-finder.preferLocal") protected boolean preferLocalWhether existing local directories with classes or existing artifacts are preferred.- Since:
- 1.1.0
-
resultFile
@Parameter(defaultValue="${project.build.directory}/duplicate-finder-result.xml", property="duplicate-finder.resultFile") protected File resultFileOutput file for the result of the plugin.- Since:
- 1.1.0
-
useResultFile
@Parameter(defaultValue="true", property="duplicate-finder.useResultFile") protected boolean useResultFileWrite result to output file.- Since:
- 1.1.0
-
resultFileMinClasspathCount
@Parameter(defaultValue="2", property="duplicate-finder.resultFileMinClasspathCount") protected int resultFileMinClasspathCountMinimum occurences on the class path to be listed in the result file.- Since:
- 1.1.0
-
includeBootClasspath
@Parameter(defaultValue="false", property="duplicate-finder.includeBootClasspath") protected boolean includeBootClasspathInclude the boot class path in duplicate detection. This will find duplicates with the JDK internal classes (e.g. the classes in rt.jar).- Since:
- 1.1.1
-
bootClasspathProperty
@Parameter(defaultValue="sun.boot.class.path", property="duplicate-finder.bootClasspathProperty") protected String bootClasspathPropertySystem property that contains the boot class path.- Since:
- 1.1.1
-
includePomProjects
@Parameter(defaultValue="false", property="duplicate-finder.includePomProjects") protected boolean includePomProjectsInclude POM projects in validation.- Since:
- 1.2.0
-
-
Method Detail
-
setLog
public void setLog(org.apache.maven.plugin.logging.Log log)
- Specified by:
setLogin interfaceorg.apache.maven.plugin.Mojo- Overrides:
setLogin classorg.apache.maven.plugin.AbstractMojo
-
setIgnoredDependencies
public void setIgnoredDependencies(org.apache.maven.model.Dependency[] dependencies) throws org.apache.maven.artifact.versioning.InvalidVersionSpecificationException- Throws:
org.apache.maven.artifact.versioning.InvalidVersionSpecificationException
-
execute
public void execute() throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException- Throws:
org.apache.maven.plugin.MojoExecutionExceptionorg.apache.maven.plugin.MojoFailureException
-
-