This issue has been created
There are 3 updates.
 
 
XWiki Commons / cid:jira-generated-image-avatar-83c05097-e958-4b85-946d-6ef6539f8190 XCOMMONS-3747 Open

Fail the build on wrong import order

 
View issue   ยท   Add comment
 

Issue created

 
cid:jira-generated-image-avatar-f842de6b-99a1-481d-a122-21d9e7f4e005 Vincent Massol created this issue on 17/Aug/26 20:16
 
Summary: Fail the build on wrong import order
Issue Type: cid:jira-generated-image-avatar-83c05097-e958-4b85-946d-6ef6539f8190 Improvement
Assignee: Unassigned
Components: Development Issues only
Created: 17/Aug/26 20:16
Priority: cid:jira-generated-image-static-major-9cd1044c-27ce-47aa-a054-2f9aa668f680 Major
Reporter: Vincent Massol
Description:

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

 
 

3 updates

 
cid:jira-generated-image-avatar-f842de6b-99a1-481d-a122-21d9e7f4e005 Changes by Vincent Massol on 17/Aug/26 20:16
 
Fix Version: 18.7.0-rc-1
Description: The XWiki Java code style [documents an import order|https://dev.xwiki.org/xwiki/bin/view/Community/CodeStyle/JavaCodeStyle/#HImports] \ ({{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\- proposal on \-wrong\-import\-order/18733 the forum |https://forum.xwiki.org/t/fail-the-build-on-wrong-import-order/18733]

.
Assignee: Vincent Massol