impsort:sort
Full name:
net.revelc.code:impsort-maven-plugin:1.12.0:sort
Description:
No description.
Attributes:
- Requires a Maven project to be executed.
- The goal is thread-safe and supports parallel builds.
- Binds by default to the lifecycle phase:
process-sources
.
Optional Parameters
Name | Type | Since | Description |
---|---|---|---|
<breadthFirstComparator> |
boolean |
1.3.0 |
Configures whether to use a breadth first comparator for sorting static imports. This will ensure all static imports from one class are grouped together before any static imports from an inner-class. Default: true User Property: impsort.breadthFirstComparator Alias: breadthFirstComparator |
<cachedir> |
File |
1.6.0 |
Projects cache directory.
This file is a hash cache of the files in the project source. It can be preserved in source code such that it ensures builds are always fast by not unnecessarily writing files constantly. It can also be added to gitignore in case startup is not necessary. It further can be redirected to another location. When stored in the repository, the cache if run on cross platforms will display the files multiple times due to line ending differences on the platform. Default: ${project.build.directory} User Property: impsort.cachedir |
<compliance> |
String |
1.5.0 |
Sets the Java source compliance level (e.g. 1.0, 1.5, 1.7, 8, 9, 11, etc.)
To enable support a specific Java version, set the version here. If you require the use of preview features, append Default: ${maven.compiler.release} User Property: impsort.compliance Alias: compliance |
<directories> |
File[] |
1.0.0 |
Location of the Java source files to process. Defaults to source main and test directories if not set. User Property: impsort.directories Alias: directories |
<excludes> |
String[] |
1.0.0 |
List of fileset patterns for Java source locations to exclude. Patterns are relative to the directories selected. When not specified, there is no default exclude. User Property: impsort.excludes Alias: excludes |
<groups> |
String |
1.0.0 |
Configures the grouping of non-static imports. Groups are defined with comma-separated package name prefixes. The special "*" group refers to imports not matching any other group, and is implied after all other groups, if not specified. More specific groups are prioritized over less specific ones. All groups are sorted. Default: * User Property: impsort.groups Alias: groups |
<ignoreParseErrorsBelowImports> |
boolean |
1.10.0 |
Allows to ignore parse errors below the imports
Whilst parsing all Java files completely only the parts above the first top level decleration are relevant for sorting the imports. This property allows to ignore all parse errors which are located under the first top level decleration. This allows import sorting with future Java versions that allow syntax not (yet) supported by the used Java parser. Warning: This is incompatible with Default: false User Property: impsort.ignoreParseErrorsBelowImports |
<includes> |
String[] |
1.0.0 |
List of fileset patterns for Java source locations to include. Patterns are relative to the directories selected. When not specified, the default include is **/*.java User Property: impsort.includes Alias: includes |
<joinStaticWithNonStatic> |
boolean |
1.0.0 |
Allows omitting the blank line between the static and non-static sections. Default: false User Property: impsort.joinStaticWithNonStatic Alias: joinStaticWithNonStatic |
<lineEnding> |
LineEnding |
1.4.0 |
Sets the line-ending of files after formatting. Valid values are:
Default: AUTO User Property: impsort.lineEnding Alias: lineEnding |
<removeUnused> |
boolean |
1.1.0 |
Configures whether to remove unused imports. Default: false User Property: impsort.removeUnused Alias: removeUnused |
<skip> |
boolean |
1.0.0 |
Allows skipping execution of this plugin. Default: false User Property: impsort.skip Alias: skip |
<staticAfter> |
boolean |
1.0.0 |
Configures whether static groups will appear after non-static groups. Default: false User Property: impsort.staticAfter Alias: staticAfter |
<staticGroups> |
String |
1.0.0 |
Configures the grouping of static imports. Groups are defined with comma-separated package name prefixes. The special "*" group refers to imports not matching any other group, and is implied after all other groups, if not specified. More specific groups are prioritized over less specific ones. All groups are sorted. Default: * User Property: impsort.staticGroups Alias: staticGroups |
<treatSamePackageAsUnused> |
boolean |
1.2.0 |
Configures whether to treat imports in the current package as unused and subject to removal along with other unused imports. Default: true User Property: impsort.treatSamePackageAsUnused Alias: treatSamePackageAsUnused |
Parameter Details
<breadthFirstComparator>
- Type:
boolean
- Since:
1.3.0
- Required:
No
- User Property:
impsort.breadthFirstComparator
- Default:
true
- Alias:
breadthFirstComparator
<cachedir>
This file is a hash cache of the files in the project source. It can be preserved in source code such that it ensures builds are always fast by not unnecessarily writing files constantly. It can also be added to gitignore in case startup is not necessary. It further can be redirected to another location.
When stored in the repository, the cache if run on cross platforms will display the files multiple times due to line ending differences on the platform.
- Type:
java.io.File
- Since:
1.6.0
- Required:
No
- User Property:
impsort.cachedir
- Default:
${project.build.directory}
<compliance>
To enable support a specific Java version, set the version here. If you require the use of preview features, append _PREVIEW
to the version. For example, to use Java 14, with preview features, set this to 14_PREVIEW
.
- Type:
java.lang.String
- Since:
1.5.0
- Required:
No
- User Property:
impsort.compliance
- Default:
${maven.compiler.release}
- Alias:
compliance
<directories>
- Type:
java.io.File[]
- Since:
1.0.0
- Required:
No
- User Property:
impsort.directories
- Alias:
directories
<excludes>
- Type:
java.lang.String[]
- Since:
1.0.0
- Required:
No
- User Property:
impsort.excludes
- Alias:
excludes
<groups>
- Type:
java.lang.String
- Since:
1.0.0
- Required:
No
- User Property:
impsort.groups
- Default:
*
- Alias:
groups
<ignoreParseErrorsBelowImports>
Whilst parsing all Java files completely only the parts above the first top level decleration are relevant for sorting the imports. This property allows to ignore all parse errors which are located under the first top level decleration. This allows import sorting with future Java versions that allow syntax not (yet) supported by the used Java parser. Warning: This is incompatible with removeUnused=true
because parse errors might cause false positives and actually used imports would be removed.
- Type:
boolean
- Since:
1.10.0
- Required:
No
- User Property:
impsort.ignoreParseErrorsBelowImports
- Default:
false
<includes>
**/*.java
- Type:
java.lang.String[]
- Since:
1.0.0
- Required:
No
- User Property:
impsort.includes
- Alias:
includes
<joinStaticWithNonStatic>
- Type:
boolean
- Since:
1.0.0
- Required:
No
- User Property:
impsort.joinStaticWithNonStatic
- Default:
false
- Alias:
joinStaticWithNonStatic
<lineEnding>
- "AUTO" - Use line endings of current system
- "KEEP" - Preserve line endings of files, default to AUTO if ambiguous
- "LF" - Use Unix and Mac style line endings
- "CRLF" - Use DOS and Windows style line endings
- "CR" - Use early Mac style line endings
- Type:
net.revelc.code.impsort.LineEnding
- Since:
1.4.0
- Required:
No
- User Property:
impsort.lineEnding
- Default:
AUTO
- Alias:
lineEnding
<removeUnused>
- Type:
boolean
- Since:
1.1.0
- Required:
No
- User Property:
impsort.removeUnused
- Default:
false
- Alias:
removeUnused
<skip>
- Type:
boolean
- Since:
1.0.0
- Required:
No
- User Property:
impsort.skip
- Default:
false
- Alias:
skip
<staticAfter>
- Type:
boolean
- Since:
1.0.0
- Required:
No
- User Property:
impsort.staticAfter
- Default:
false
- Alias:
staticAfter
<staticGroups>
- Type:
java.lang.String
- Since:
1.0.0
- Required:
No
- User Property:
impsort.staticGroups
- Default:
*
- Alias:
staticGroups
<treatSamePackageAsUnused>
- Type:
boolean
- Since:
1.2.0
- Required:
No
- User Property:
impsort.treatSamePackageAsUnused
- Default:
true
- Alias:
treatSamePackageAsUnused