Skip to content

Commit 9b79de9

Browse files
cxzl25dongjoon-hyun
authored andcommitted
ORC-1665: Migrate to importOrder of spotless-maven-plugin
### What changes were proposed in this pull request? This PR aims to enable the `importOrder` function in `spotless-maven-plugin`. ```bash mvn spotless:apply -Panalyze ``` ### Why are the changes needed? Although there is now checkstyle to limit the order of imports, it cannot be automatically adjusted. `spotless-maven-plugin` can check and automatically adjust. #1859 (review) ### How was this patch tested? local test ### Was this patch authored or co-authored using generative AI tooling? No Closes #1860 from cxzl25/ORC-1665. Authored-by: sychen <sychen@ctrip.com> Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
1 parent e169011 commit 9b79de9

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

java/checkstyle.xml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,6 @@
3838
<property name="allowClassImports" value="false"/>
3939
<property name="allowStaticMemberImports" value="false"/>
4040
</module>
41-
<module name="RedundantImport"/>
42-
<!-- https://checkstyle.sourceforge.io/config_imports.html#ImportOrder IntelliJ default example -->
43-
<module name="CustomImportOrder">
44-
<property name="customImportOrderRules" value="THIRD_PARTY_PACKAGE###SPECIAL_IMPORTS###STANDARD_JAVA_PACKAGE###STATIC"/>
45-
<property name="specialImportsRegExp" value="^javax\."/>
46-
<property name="standardPackageRegExp" value="^java\."/>
47-
<property name="sortImportsInGroupAlphabetically" value="true"/>
48-
<property name="separateLineBetweenGroups" value="false"/>
49-
</module>
5041
<module name="ModifierOrder"/>
5142
<module name="RedundantModifier"/>
5243
<module name="NoLineWrap"/>

java/pom.xml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,15 @@
350350
</sortPom>
351351
</pom>
352352
<java>
353+
<includes>
354+
<include>src/java/**/*.java</include>
355+
</includes>
356+
<excludes>
357+
<exclude>src/test/**/*.java</exclude>
358+
</excludes>
359+
<importOrder>
360+
<order>,javax|java,\#</order>
361+
</importOrder>
353362
<removeUnusedImports></removeUnusedImports>
354363
</java>
355364
</configuration>

0 commit comments

Comments
 (0)