@@ -69,6 +69,32 @@ under the License.
6969 <executableJava >java</executableJava >
7070 <jmhProfArgument > </jmhProfArgument >
7171 <profilerOutputDir >${build.directory}/profile-results</profilerOutputDir >
72+
73+ <!-- The spotless related.-->
74+ <checkstyle .version>10.18.2</checkstyle .version>
75+ <spotless .skip>false</spotless .skip>
76+ <spotless .version>2.43.0</spotless .version>
77+ <spotless .scalafmt.version>3.4.3</spotless .scalafmt.version>
78+ <spotless .delimiter>package</spotless .delimiter>
79+ <spotless .license.header>
80+ /*
81+ * Licensed to the Apache Software Foundation (ASF) under one
82+ * or more contributor license agreements. See the NOTICE file
83+ * distributed with this work for additional information
84+ * regarding copyright ownership. The ASF licenses this file
85+ * to you under the Apache License, Version 2.0 (the
86+ * "License"); you may not use this file except in compliance
87+ * with the License. You may obtain a copy of the License at
88+ *
89+ * http://www.apache.org/licenses/LICENSE-2.0
90+ *
91+ * Unless required by applicable law or agreed to in writing, software
92+ * distributed under the License is distributed on an "AS IS" BASIS,
93+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
94+ * See the License for the specific language governing permissions and
95+ * limitations under the License.
96+ */
97+ </spotless .license.header>
7298 </properties >
7399
74100 <repositories >
@@ -630,7 +656,82 @@ under the License.
630656 </profiles >
631657
632658 <build >
633- <extensions >
659+
660+ <pluginManagement >
661+ <plugins >
662+ <plugin >
663+ <groupId >org.apache.maven.plugins</groupId >
664+ <artifactId >maven-checkstyle-plugin</artifactId >
665+ <version >3.3.1</version >
666+ <dependencies >
667+ <dependency >
668+ <groupId >com.puppycrawl.tools</groupId >
669+ <artifactId >checkstyle</artifactId >
670+ <!-- Note: match version with docs/flinkDev/ide_setup.md -->
671+ <version >${checkstyle.version} </version >
672+ </dependency >
673+ </dependencies >
674+
675+ <executions >
676+ <execution >
677+ <id >validate</id >
678+ <phase >validate</phase >
679+ <goals >
680+ <goal >check</goal >
681+ </goals >
682+ </execution >
683+ </executions >
684+ <configuration >
685+ <!-- Skip the packages, because the classes in the package is generated to follow thrift.-->
686+ <excludes >
687+ org/apache/flink/benchmark/thrift/**
688+ </excludes >
689+ <suppressionsLocation >/tools/maven/suppressions.xml</suppressionsLocation >
690+ <includeTestSourceDirectory >true</includeTestSourceDirectory >
691+ <configLocation >/tools/maven/checkstyle.xml</configLocation >
692+ <logViolationsToConsole >true</logViolationsToConsole >
693+ <failOnViolation >true</failOnViolation >
694+ </configuration >
695+ </plugin >
696+
697+ <plugin >
698+ <groupId >com.diffplug.spotless</groupId >
699+ <artifactId >spotless-maven-plugin</artifactId >
700+ <version >${spotless.version} </version >
701+ <configuration >
702+ <java >
703+ <googleJavaFormat >
704+ <version >1.24.0</version >
705+ <style >AOSP</style >
706+ </googleJavaFormat >
707+
708+ <!-- \# refers to the static imports -->
709+ <importOrder >
710+ <order >org.apache.flink,org.apache.flink.shaded,,javax,java,scala,\#</order >
711+ </importOrder >
712+
713+ <removeUnusedImports />
714+
715+ <excludes >
716+ <!-- Skip the packages, because the classes in the package is generated to follow thrift.-->
717+ <exclude >src/main/java/org/apache/flink/benchmark/thrift/**</exclude >
718+ </excludes >
719+ </java >
720+ </configuration >
721+ <executions >
722+ <execution >
723+ <id >spotless-check</id >
724+ <phase >validate</phase >
725+ <goals >
726+ <goal >check</goal >
727+ </goals >
728+ </execution >
729+ </executions >
730+ </plugin >
731+ </plugins >
732+ </pluginManagement >
733+
734+ <extensions >
634735 <!-- required for getting the correct protoc binary for protobuf -->
635736 <extension >
636737 <groupId >kr.motd.maven</groupId >
@@ -754,6 +855,14 @@ under the License.
754855 </execution >
755856 </executions >
756857 </plugin >
858+ <plugin >
859+ <groupId >org.apache.maven.plugins</groupId >
860+ <artifactId >maven-checkstyle-plugin</artifactId >
861+ </plugin >
862+ <plugin >
863+ <groupId >com.diffplug.spotless</groupId >
864+ <artifactId >spotless-maven-plugin</artifactId >
865+ </plugin >
757866 </plugins >
758867 </build >
759868</project >
0 commit comments