Merge remote-tracking branch 'origin/main'

# Conflicts:
#	pom.xml
This commit is contained in:
spencergibb
2021-11-29 12:04:29 -05:00
4 changed files with 157 additions and 3 deletions

View File

@@ -227,6 +227,57 @@ Go to `File` -> `Settings` -> `Other settings` -> `Checkstyle`. There click on t
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>
----
== Flattening the POMs
To avoid propagating build setup that is required to build a Spring Cloud project, we're using the maven flatten plugin. It has the advantage of letting you use whatever features you need while publishing "clean" pom to the repository.

View File

@@ -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>
----

54
pom.xml
View File

@@ -28,7 +28,7 @@
<maven.compiler.target>${java.version}</maven.compiler.target>
<main.basedir>${basedir}</main.basedir>
<docs.main>${project.artifactId}</docs.main>
<spring-boot.version>2.6.0</spring-boot.version>
<spring-boot.version>2.6.1</spring-boot.version>
<spring-cloud-build.version>3.1.0-SNAPSHOT</spring-cloud-build.version>
<docs.resources.dir>${project.build.directory}/build-docs</docs.resources.dir>
<docs.classes.dir>${project.build.directory}/build-docs-classes</docs.classes.dir>
@@ -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>
<maven.deploy.skip>false</maven.deploy.skip>
</properties>
<dependencyManagement>
@@ -643,6 +661,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>

View File

@@ -14,12 +14,12 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>2.6.0</version>
<version>2.6.1</version>
<relativePath/>
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring-boot.version>2.6.0</spring-boot.version>
<spring-boot.version>2.6.1</spring-boot.version>
</properties>
<build>
<plugins>