| The XWiki Java code style documents an import order (java, javax, jakarta, org, com, anything else, then static imports, each group separated by a blank line and sorted alphabetically), and the IntelliJ IDEA and Eclipse settings we ship produce exactly that order, but nothing verifies it at build time. As a consequence:
- A file whose imports are in the wrong order produces a spurious diff as soon as somebody with a properly configured IDE touches it.
- The order has to be corrected by hand during reviews, both for contributions from non-committers and for code written by coding agents.
Enable Checkstyle's ImportOrder check so that a wrong import order fails the build, for main sources (checkstyle.xml) as well as for test sources (checkstyle-test.xml). Note that this applies to every project inheriting the XWiki parent POM, including xwiki-contrib extensions. See the proposal: https://forum.xwiki.org/t/fail-the-build-on-wrong-import-order/18733 |