java - How do I get Checkstyle CustomImportOrder to work with IntelliJ properly? -


i'm trying checkstyle (via maven-checkstyle-plugin) have intellij imports checked using checkstyle customimportorder module. despite having ordered imports according intellij's default rules, checkstyle still says import order wrong.

here's imports (ordered according intellij rules (ctrl+o):

import org.codehaus.jackson.jsonnode;  import javax.sql.rowset.serial.sqloutputimpl; import java.util.arraylist; import java.util.list; 

here's warning message checkstyle:

[warning] src\main\java\com\example\hej\enklass.java[5] (imports) customimportorder: import statement in wrong order. should in 'special_imports' group. [warning] src\main\java\com\example\hej\enklass.java[6] (imports) customimportorder: import statement in wrong order. should in 'standard_java_package' group. [warning] src\main\java\com\example\hej\enklass.java[7] (imports) customimportorder: import statement in wrong order. should in 'standard_java_package' group. 

here's checkstyle.xml customimportorder rules (as recommended intellij checkstyle site):

<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> 

what might problem here? have been trying switch rules around, no luck. have tried remove/manipulate regexes no luck.

default formatting in intellij looks follows:

all other imports <blank line> javax.* in alphabetical order java.* in alphabetical order <blank line> static imports in alphabetical order 

right now, not possible sort java , javax separately without blank line in-between , that's why have violations.

i've raised issue on github solve , require changes in checkstyle code.

as workaround may add blank line between javax , java in intellij idea configuration , should easy tune checkstyle work that.


Comments

Popular posts from this blog

java - Date formats difference between yyyy-MM-dd'T'HH:mm:ss and yyyy-MM-dd'T'HH:mm:ssXXX -

c# - Get rid of xmlns attribute when adding node to existing xml -