Add duplicate finder (#220)
* Add duplicate finder to plugins and executions. * Add duplicate finder to plugins and executions. * Fix docs.
This commit is contained in:
committed by
GitHub
parent
e874b69be7
commit
4493fa05ea
@@ -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]
|
||||
----
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.basepom.maven</groupId>
|
||||
<artifactId>duplicate-finder-maven-plugin</artifactId>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
----
|
||||
|
||||
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]
|
||||
----
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.basepom.maven</groupId>
|
||||
<artifactId>duplicate-finder-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<ignoredClassPatterns>
|
||||
<ignoredClassPattern>org.joda.time.base.BaseDateTime</ignoredClassPattern>
|
||||
<ignoredClassPattern>.*module-info</ignoredClassPattern>
|
||||
</ignoredClassPatterns>
|
||||
<ignoredResourcePatterns>
|
||||
<ignoredResourcePattern>changelog.txt</ignoredResourcePattern>
|
||||
</ignoredResourcePatterns>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
|
||||
----
|
||||
|
||||
|
||||
52
pom.xml
52
pom.xml
@@ -121,6 +121,24 @@
|
||||
<readme.main.classpath>${docs.classes.dir}</readme.main.classpath>
|
||||
<readme.class.path>readme.class.path</readme.class.path>
|
||||
<sonar-jacoco-listeners.version>5.14.0.18788</sonar-jacoco-listeners.version>
|
||||
<duplicate-finder-maven-plugin.version>1.5.0</duplicate-finder-maven-plugin.version>
|
||||
<duplicate-finder-maven-plugin.printEqualFiles>false</duplicate-finder-maven-plugin.printEqualFiles>
|
||||
<duplicate-finder-maven-plugin.failBuildInCaseOfDifferentContentConflict>false</duplicate-finder-maven-plugin.failBuildInCaseOfDifferentContentConflict>
|
||||
<duplicate-finder-maven-plugin.failBuildInCaseOfEqualContentConflict>false</duplicate-finder-maven-plugin.failBuildInCaseOfEqualContentConflict>
|
||||
<duplicate-finder-maven-plugin.failBuildInCaseOfConflict>true</duplicate-finder-maven-plugin.failBuildInCaseOfConflict>
|
||||
<duplicate-finder-maven-plugin.checkCompileClasspath>true</duplicate-finder-maven-plugin.checkCompileClasspath>
|
||||
<duplicate-finder-maven-plugin.checkRuntimeClasspath>true</duplicate-finder-maven-plugin.checkRuntimeClasspath>
|
||||
<duplicate-finder-maven-plugin.checkTestClasspath>true</duplicate-finder-maven-plugin.checkTestClasspath>
|
||||
<duplicate-finder-maven-plugin.skip>false</duplicate-finder-maven-plugin.skip>
|
||||
<duplicate-finder-maven-plugin.quiet>false</duplicate-finder-maven-plugin.quiet>
|
||||
<duplicate-finder-maven-plugin.preferLocal>true</duplicate-finder-maven-plugin.preferLocal>
|
||||
<duplicate-finder-maven-plugin.useResultFile>true</duplicate-finder-maven-plugin.useResultFile>
|
||||
<duplicate-finder-maven-plugin.resultFileMinClasspathCount>2</duplicate-finder-maven-plugin.resultFileMinClasspathCount>
|
||||
<duplicate-finder-maven-plugin.resultFile>${project.build.directory}/duplicate-finder-result.xml</duplicate-finder-maven-plugin.resultFile>
|
||||
<duplicate-finder-maven-plugin.includeBootClasspath>false</duplicate-finder-maven-plugin.includeBootClasspath>
|
||||
<duplicate-finder-maven-plugin.bootClasspathProperty>sun.boot.class.path</duplicate-finder-maven-plugin.bootClasspathProperty>
|
||||
<duplicate-finder-maven-plugin.useDefaultResourceIgnoreList>true</duplicate-finder-maven-plugin.useDefaultResourceIgnoreList>
|
||||
<duplicate-finder-maven-plugin.includePomProjects>false</duplicate-finder-maven-plugin.includePomProjects>
|
||||
</properties>
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
@@ -642,6 +660,40 @@
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.basepom.maven</groupId>
|
||||
<artifactId>duplicate-finder-maven-plugin</artifactId>
|
||||
<version>${duplicate-finder-maven-plugin.version}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>duplicate-validation</id>
|
||||
<phase>verify</phase>
|
||||
<goals>
|
||||
<goal>check</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<printEqualFiles>${duplicate-finder-maven-plugin.printEqualFiles}</printEqualFiles>
|
||||
<failBuildInCaseOfDifferentContentConflict>${duplicate-finder-maven-plugin.failBuildInCaseOfDifferentContentConflict}</failBuildInCaseOfDifferentContentConflict>
|
||||
<failBuildInCaseOfEqualContentConflict>${duplicate-finder-maven-plugin.failBuildInCaseOfEqualContentConflict}</failBuildInCaseOfEqualContentConflict>
|
||||
<failBuildInCaseOfConflict>${duplicate-finder-maven-plugin.failBuildInCaseOfConflict}</failBuildInCaseOfConflict>
|
||||
<checkCompileClasspath>${duplicate-finder-maven-plugin.checkCompileClasspath}</checkCompileClasspath>
|
||||
<checkRuntimeClasspath>${duplicate-finder-maven-plugin.checkRuntimeClasspath}</checkRuntimeClasspath>
|
||||
<checkTestClasspath>${duplicate-finder-maven-plugin.checkTestClasspath}</checkTestClasspath>
|
||||
<skip>${duplicate-finder-maven-plugin.skip}</skip>
|
||||
<quiet>${duplicate-finder-maven-plugin.quiet}</quiet>
|
||||
<preferLocal>${duplicate-finder-maven-plugin.preferLocal}</preferLocal>
|
||||
<useResultFile>${duplicate-finder-maven-plugin.useResultFile}</useResultFile>
|
||||
<resultFileMinClasspathCount>${duplicate-finder-maven-plugin.resultFileMinClasspathCount}</resultFileMinClasspathCount>
|
||||
<resultFile>${duplicate-finder-maven-plugin.resultFile}</resultFile>
|
||||
<includeBootClasspath>${duplicate-finder-maven-plugin.includeBootClasspath}</includeBootClasspath>
|
||||
<bootClasspathProperty>${duplicate-finder-maven-plugin.bootClasspathProperty}</bootClasspathProperty>
|
||||
<useDefaultResourceIgnoreList>${duplicate-finder-maven-plugin.useDefaultResourceIgnoreList}</useDefaultResourceIgnoreList>
|
||||
<includePomProjects>${duplicate-finder-maven-plugin.includePomProjects}</includePomProjects>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
</plugins>
|
||||
</pluginManagement>
|
||||
</build>
|
||||
|
||||
Reference in New Issue
Block a user