Skip to content

Commit

Permalink
ORC-1665: Migrate to importOrder of spotless-maven-plugin
Browse files Browse the repository at this point in the history
### 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>
  • Loading branch information
cxzl25 authored and dongjoon-hyun committed Mar 26, 2024
1 parent e169011 commit 9b79de9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
9 changes: 0 additions & 9 deletions java/checkstyle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,6 @@
<property name="allowClassImports" value="false"/>
<property name="allowStaticMemberImports" value="false"/>
</module>
<module name="RedundantImport"/>
<!-- https://checkstyle.sourceforge.io/config_imports.html#ImportOrder IntelliJ default example -->
<module name="CustomImportOrder">
<property name="customImportOrderRules" value="THIRD_PARTY_PACKAGE###SPECIAL_IMPORTS###STANDARD_JAVA_PACKAGE###STATIC"/>
<property name="specialImportsRegExp" value="^javax\."/>
<property name="standardPackageRegExp" value="^java\."/>
<property name="sortImportsInGroupAlphabetically" value="true"/>
<property name="separateLineBetweenGroups" value="false"/>
</module>
<module name="ModifierOrder"/>
<module name="RedundantModifier"/>
<module name="NoLineWrap"/>
Expand Down
9 changes: 9 additions & 0 deletions java/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,15 @@
</sortPom>
</pom>
<java>
<includes>
<include>src/java/**/*.java</include>
</includes>
<excludes>
<exclude>src/test/**/*.java</exclude>
</excludes>
<importOrder>
<order>,javax|java,\#</order>
</importOrder>
<removeUnusedImports></removeUnusedImports>
</java>
</configuration>
Expand Down

0 comments on commit 9b79de9

Please sign in to comment.