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.AbstractMojo
Finds duplicate classes/resources on the classpath.
  • Field Details

    • project

      @Parameter(defaultValue="${project}", readonly=true) public org.apache.maven.project.MavenProject project
      The maven project (effective pom).
    • printEqualFiles

      @Parameter(defaultValue="false", property="duplicate-finder.printEqualFiles") public boolean printEqualFiles
      Report files that have the same sha256 has value.
      Since:
      1.0.6
    • failBuildInCaseOfDifferentContentConflict

      @Parameter(defaultValue="false", property="duplicate-finder.failBuildInCaseOfDifferentContentConflict") public boolean failBuildInCaseOfDifferentContentConflict
      Fail 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") public boolean failBuildInCaseOfEqualContentConflict
      Fail 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") public boolean failBuildInCaseOfConflict
      Fail the build if any files with the same name are found.
    • useDefaultResourceIgnoreList

      @Parameter(defaultValue="true", property="duplicate-finder.useDefaultResourceIgnoreList") public boolean useDefaultResourceIgnoreList
      Use the default resource ignore list.
    • useDefaultClassIgnoreList

      @Parameter(defaultValue="true", property="duplicate-finder.useDefaultClassIgnoreList") public boolean useDefaultClassIgnoreList
      Use the default class ignore list.
      Since:
      1.2.1
    • ignoredResourcePatterns

      @Parameter public String[] ignoredResourcePatterns
      Ignored resources, which are not checked for multiple occurences.
    • ignoredClassPatterns

      @Parameter public String[] ignoredClassPatterns
      Ignored classes, which are not checked for multiple occurences.
      Since:
      1.2.1
    • conflictingDependencies

      @Parameter(alias="exceptions") public ConflictingDependency[] conflictingDependencies
      Artifacts with expected and resolved versions that are checked.
    • checkCompileClasspath

      @Parameter(defaultValue="true", property="duplicate-finder.checkCompileClasspath") public boolean checkCompileClasspath
      Check resources and classes on the compile class path.
    • checkRuntimeClasspath

      @Parameter(defaultValue="true", property="duplicate-finder.checkRuntimeClasspath") public boolean checkRuntimeClasspath
      Check resources and classes on the runtime class path.
    • checkTestClasspath

      @Parameter(defaultValue="true", property="duplicate-finder.checkTestClasspath") public boolean checkTestClasspath
      Check resources and classes on the test class path.
    • skip

      @Parameter(defaultValue="false", property="duplicate-finder.skip") public boolean skip
      Skips the plugin execution.
    • quiet

      @Parameter(defaultValue="false", property="duplicate-finder.quiet") @Deprecated public boolean quiet
      Deprecated.
      Maven logging controls the log level now.
      Quiets the plugin (report only errors).
      Since:
      1.1.0
    • preferLocal

      @Parameter(defaultValue="true", property="duplicate-finder.preferLocal") public boolean preferLocal
      Whether 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") public File resultFile
      Output file for the result of the plugin.
      Since:
      1.1.0
    • useResultFile

      @Parameter(defaultValue="true", property="duplicate-finder.useResultFile") public boolean useResultFile
      Write result to output file.
      Since:
      1.1.0
    • resultFileMinClasspathCount

      @Parameter(defaultValue="2", property="duplicate-finder.resultFileMinClasspathCount") public int resultFileMinClasspathCount
      Minimum occurences on the class path to be listed in the result file.
      Since:
      1.1.0
    • includeBootClasspath

      @Parameter(defaultValue="false", property="duplicate-finder.includeBootClasspath") @Deprecated public boolean includeBootClasspath
      Deprecated.
      Inspecting the boot classpath is no longer supported in Java 9+
      Include 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(property="duplicate-finder.bootClasspathProperty") @Deprecated public String bootClasspathProperty
      Deprecated.
      Inspecting the boot classpath is no longer supported in Java 9+
      System property that contains the boot class path.
      Since:
      1.1.1
    • includePomProjects

      @Parameter(defaultValue="false", property="duplicate-finder.includePomProjects") public boolean includePomProjects
      Include POM projects in validation.
      Since:
      1.2.0
  • Constructor Details

    • DuplicateFinderMojo

      public DuplicateFinderMojo()
  • Method Details

    • 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.MojoExecutionException
      org.apache.maven.plugin.MojoFailureException