From 4493fa05eadb35ba0fd1106ffba5ad84a83bbe44 Mon Sep 17 00:00:00 2001 From: Olga Maciaszek-Sharma Date: Fri, 26 Nov 2021 08:41:00 +0100 Subject: [PATCH] Add duplicate finder (#220) * Add duplicate finder to plugins and executions. * Add duplicate finder to plugins and executions. * Fix docs. --- docs/src/main/asciidoc/contributing.adoc | 51 +++++++++++++++++++++++ pom.xml | 52 ++++++++++++++++++++++++ 2 files changed, 103 insertions(+) diff --git a/docs/src/main/asciidoc/contributing.adoc b/docs/src/main/asciidoc/contributing.adoc index e36b0a49..71f8aab5 100644 --- a/docs/src/main/asciidoc/contributing.adoc +++ b/docs/src/main/asciidoc/contributing.adoc @@ -177,3 +177,54 @@ Go to `File` -> `Settings` -> `Other settings` -> `Checkstyle`. There click on t - `checkstyle.additional.suppressions.file` - this variable corresponds to suppressions in your local project. E.g. you're working on `spring-cloud-contract`. Then point to the `project-root/src/checkstyle/checkstyle-suppressions.xml` folder. Example for `spring-cloud-contract` would be: `/home/username/spring-cloud-contract/src/checkstyle/checkstyle-suppressions.xml`. IMPORTANT: Remember to set the `Scan Scope` to `All sources` since we apply checkstyle rules for production and test sources. + +=== Duplicate Finder + +Spring Cloud Build brings along the `basepom:duplicate-finder-maven-plugin`, that enables flagging duplicate and conflicting classes and resources on the java classpath. + +==== Duplicate Finder configuration + +Duplicate finder is *enabled by default* and will run in the `verify` phase of your Maven build, but it will only take effect in your project if you add the `duplicate-finder-maven-plugin` to the `build` section of the projecst's `pom.xml`. + +.pom.xml +[source,xml] +---- + + + + org.basepom.maven + duplicate-finder-maven-plugin + + + +---- + +For other properties, we have set defaults as listed in the https://github.com/basepom/duplicate-finder-maven-plugin/wiki[plugin documentation]. + +You can easily override them but setting the value of the selected property prefixed with `duplicate-finder-maven-plugin`. For example, set `duplicate-finder-maven-plugin.skip` to `true` in order to skip duplicates check in your build. + +If you need to add `ignoredClassPatterns` or `ignoredResourcePatterns` to your setup, make sure to add them in the plugin configuration section of your project: + +[source,xml] +---- + + + + org.basepom.maven + duplicate-finder-maven-plugin + + + org.joda.time.base.BaseDateTime + .*module-info + + + changelog.txt + + + + + + + +---- + diff --git a/pom.xml b/pom.xml index 45b0b45f..ef0ac77d 100644 --- a/pom.xml +++ b/pom.xml @@ -121,6 +121,24 @@ ${docs.classes.dir} readme.class.path 5.14.0.18788 + 1.5.0 + false + false + false + true + true + true + true + false + false + true + true + 2 + ${project.build.directory}/duplicate-finder-result.xml + false + sun.boot.class.path + true + false @@ -642,6 +660,40 @@ + + org.basepom.maven + duplicate-finder-maven-plugin + ${duplicate-finder-maven-plugin.version} + + + duplicate-validation + verify + + check + + + + + ${duplicate-finder-maven-plugin.printEqualFiles} + ${duplicate-finder-maven-plugin.failBuildInCaseOfDifferentContentConflict} + ${duplicate-finder-maven-plugin.failBuildInCaseOfEqualContentConflict} + ${duplicate-finder-maven-plugin.failBuildInCaseOfConflict} + ${duplicate-finder-maven-plugin.checkCompileClasspath} + ${duplicate-finder-maven-plugin.checkRuntimeClasspath} + ${duplicate-finder-maven-plugin.checkTestClasspath} + ${duplicate-finder-maven-plugin.skip} + ${duplicate-finder-maven-plugin.quiet} + ${duplicate-finder-maven-plugin.preferLocal} + ${duplicate-finder-maven-plugin.useResultFile} + ${duplicate-finder-maven-plugin.resultFileMinClasspathCount} + ${duplicate-finder-maven-plugin.resultFile} + ${duplicate-finder-maven-plugin.includeBootClasspath} + ${duplicate-finder-maven-plugin.bootClasspathProperty} + ${duplicate-finder-maven-plugin.useDefaultResourceIgnoreList} + ${duplicate-finder-maven-plugin.includePomProjects} + + +