@@ -332,9 +332,11 @@ limitations under the License.
332
332
<plexusDistMgmtSnapshotsUrl >https://oss.sonatype.org/content/repositories/plexus-snapshots</plexusDistMgmtSnapshotsUrl >
333
333
<project .build.outputTimestamp>2023-05-06T22:13:46Z</project .build.outputTimestamp>
334
334
<gpg .useagent>true</gpg .useagent>
335
+ <spotless-maven-plugin .version>2.36.0</spotless-maven-plugin .version>
335
336
<mavenPluginToolsVersion >3.9.0</mavenPluginToolsVersion >
336
337
<mavenFluidoSkinVersion >1.11.2</mavenFluidoSkinVersion >
337
338
<junit5Version >5.9.3</junit5Version >
339
+ <spotless .action>check</spotless .action>
338
340
</properties >
339
341
340
342
<dependencyManagement >
@@ -424,7 +426,8 @@ limitations under the License.
424
426
<configuration >
425
427
<quiet >true</quiet >
426
428
<locale >en</locale >
427
- <notimestamp >true</notimestamp ><!-- avoid noise for svn/gitpubsub -->
429
+ <!-- avoid noise for svn/gitpubsub -->
430
+ <notimestamp >true</notimestamp >
428
431
</configuration >
429
432
</plugin >
430
433
<plugin >
@@ -550,6 +553,41 @@ limitations under the License.
550
553
</execution >
551
554
</executions >
552
555
</plugin >
556
+ <plugin >
557
+ <groupId >com.diffplug.spotless</groupId >
558
+ <artifactId >spotless-maven-plugin</artifactId >
559
+ <version >${spotless-maven-plugin.version} </version >
560
+ <configuration >
561
+ <java >
562
+ <!-- orders of used formatters are important -->
563
+ <!-- eg. palantir override importOrder, so should be first -->
564
+ <palantirJavaFormat />
565
+ <removeUnusedImports />
566
+ <importOrder >
567
+ <order >javax,java,,\#</order >
568
+ </importOrder >
569
+ </java >
570
+ <pom >
571
+ <sortPom >
572
+ <expandEmptyElements >false</expandEmptyElements >
573
+ <!-- https://issues.apache.org/jira/browse/MRELEASE-1111 -->
574
+ <spaceBeforeCloseEmptyElement >true</spaceBeforeCloseEmptyElement >
575
+ </sortPom >
576
+ </pom >
577
+ <upToDateChecking >
578
+ <enabled >true</enabled >
579
+ </upToDateChecking >
580
+ </configuration >
581
+ <executions >
582
+ <execution >
583
+ <id >spotless-check</id >
584
+ <goals >
585
+ <goal >${spotless.action} </goal >
586
+ </goals >
587
+ <phase >process-sources</phase >
588
+ </execution >
589
+ </executions >
590
+ </plugin >
553
591
</plugins >
554
592
</pluginManagement >
555
593
<plugins >
@@ -641,18 +679,6 @@ limitations under the License.
641
679
<groupId >org.apache.maven.plugins</groupId >
642
680
<artifactId >maven-surefire-report-plugin</artifactId >
643
681
</plugin >
644
- <plugin >
645
- <groupId >org.apache.maven.plugins</groupId >
646
- <artifactId >maven-checkstyle-plugin</artifactId >
647
- <reportSets >
648
- <reportSet >
649
- <id >default</id >
650
- <reports >
651
- <report >checkstyle</report >
652
- </reports >
653
- </reportSet >
654
- </reportSets >
655
- </plugin >
656
682
<plugin >
657
683
<groupId >org.apache.maven.plugins</groupId >
658
684
<artifactId >maven-pmd-plugin</artifactId >
@@ -764,5 +790,57 @@ limitations under the License.
764
790
</plugins >
765
791
</build >
766
792
</profile >
793
+
794
+ <profile >
795
+ <id >java11+</id >
796
+ <activation >
797
+ <jdk >[11,)</jdk >
798
+ </activation >
799
+
800
+ <properties >
801
+ <maven .compiler.release>${javaVersion} </maven .compiler.release>
802
+ <!-- configuration for checkstyle to use with spotless -->
803
+ <checkstyle .spotless.config>config/maven_checks_nocodestyle.xml</checkstyle .spotless.config>
804
+ </properties >
805
+
806
+ <build >
807
+ <!-- - newer versions of plugins requires JDK 11 -->
808
+ <plugins >
809
+ <plugin >
810
+ <groupId >com.diffplug.spotless</groupId >
811
+ <artifactId >spotless-maven-plugin</artifactId >
812
+ </plugin >
813
+ <plugin >
814
+ <groupId >org.apache.maven.plugins</groupId >
815
+ <artifactId >maven-checkstyle-plugin</artifactId >
816
+ <configuration >
817
+ <configLocation >${checkstyle.spotless.config} </configLocation >
818
+ </configuration >
819
+ </plugin >
820
+ </plugins >
821
+ </build >
822
+ </profile >
823
+ <profile >
824
+ <id >format-check</id >
825
+ <activation >
826
+ <property >
827
+ <name >!format</name >
828
+ </property >
829
+ </activation >
830
+ <properties >
831
+ <spotless .action>check</spotless .action>
832
+ </properties >
833
+ </profile >
834
+ <profile >
835
+ <id >format</id >
836
+ <activation >
837
+ <property >
838
+ <name >format</name >
839
+ </property >
840
+ </activation >
841
+ <properties >
842
+ <spotless .action>apply</spotless .action>
843
+ </properties >
844
+ </profile >
767
845
</profiles >
768
846
</project >
0 commit comments