Class 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 Detail

      • printEqualFiles

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

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

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

        @Parameter(defaultValue="true",
                   property="duplicate-finder.useDefaultClassIgnoreList")
        protected boolean useDefaultClassIgnoreList
        Use 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 checkCompileClasspath
        Check resources and classes on the compile class path.
      • checkRuntimeClasspath

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

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

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

        @Parameter(defaultValue="false",
                   property="duplicate-finder.quiet")
        protected boolean quiet
        Quiets the plugin (report only errors).
        Since:
        1.1.0
      • preferLocal

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

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

        @Parameter(defaultValue="2",
                   property="duplicate-finder.resultFileMinClasspathCount")
        protected 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")
        protected boolean includeBootClasspath
        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(defaultValue="sun.boot.class.path",
                   property="duplicate-finder.bootClasspathProperty")
        protected String bootClasspathProperty
        System property that contains the boot class path.
        Since:
        1.1.1
      • includePomProjects

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

      • DuplicateFinderMojo

        public DuplicateFinderMojo()
    • Method Detail

      • setLog

        public void setLog​(org.apache.maven.plugin.logging.Log log)
        Specified by:
        setLog in interface org.apache.maven.plugin.Mojo
        Overrides:
        setLog in class org.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.MojoExecutionException
        org.apache.maven.plugin.MojoFailureException