Fork me on GitHub

impsort:sort

Full name:

net.revelc.code:impsort-maven-plugin:1.6.2:sort

Description:

(no description)

Attributes:

  • Requires a Maven project to be executed.
  • 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 value is: true.
User property is: impsort.breadthFirstComparator.
Alias is: 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 value is: ${project.build.directory}.
User property is: 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 _PREVIEW to the version. For example, to use Java 14, with preview features, set this to 14_PREVIEW.


Default value is: ${maven.compiler.release}.
User property is: impsort.compliance.
Alias is: 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 is: impsort.directories.
Alias is: 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 is: impsort.excludes.
Alias is: 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 value is: *.
User property is: impsort.groups.
Alias is: groups.
<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 is: impsort.includes.
Alias is: includes.
<joinStaticWithNonStatic> boolean 1.0.0 Allows omitting the blank line between the static and non-static sections.
Default value is: false.
User property is: impsort.joinStaticWithNonStatic.
Alias is: joinStaticWithNonStatic.
<lineEnding> LineEnding 1.4.0 Sets the line-ending of files after formatting. Valid values are:
  • "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

Default value is: AUTO.
User property is: impsort.lineEnding.
Alias is: lineEnding.
<removeUnused> boolean 1.1.0 Configures whether to remove unused imports.
Default value is: false.
User property is: impsort.removeUnused.
Alias is: removeUnused.
<skip> boolean 1.0.0 Allows skipping execution of this plugin.
Default value is: false.
User property is: impsort.skip.
Alias is: skip.
<staticAfter> boolean 1.0.0 Configures whether static groups will appear after non-static groups.
Default value is: false.
User property is: impsort.staticAfter.
Alias is: 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 value is: *.
User property is: impsort.staticGroups.
Alias is: 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 value is: true.
User property is: impsort.treatSamePackageAsUnused.
Alias is: treatSamePackageAsUnused.

Parameter Details

<breadthFirstComparator>

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.
  • Type: boolean
  • Since: 1.3.0
  • Required: No
  • User Property: impsort.breadthFirstComparator
  • Default: true
  • Alias: breadthFirstComparator

<cachedir>

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.

  • Type: java.io.File
  • Since: 1.6.0
  • Required: No
  • User Property: impsort.cachedir
  • Default: ${project.build.directory}

<compliance>

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

Location of the Java source files to process. Defaults to source main and test directories if not set.
  • Type: java.io.File[]
  • Since: 1.0.0
  • Required: No
  • User Property: impsort.directories
  • Alias: directories

<excludes>

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.
  • Type: java.lang.String[]
  • Since: 1.0.0
  • Required: No
  • User Property: impsort.excludes
  • Alias: excludes

<groups>

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.
  • Type: java.lang.String
  • Since: 1.0.0
  • Required: No
  • User Property: impsort.groups
  • Default: *
  • Alias: groups

<includes>

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
  • Type: java.lang.String[]
  • Since: 1.0.0
  • Required: No
  • User Property: impsort.includes
  • Alias: includes

<joinStaticWithNonStatic>

Allows omitting the blank line between the static and non-static sections.
  • Type: boolean
  • Since: 1.0.0
  • Required: No
  • User Property: impsort.joinStaticWithNonStatic
  • Default: false
  • Alias: joinStaticWithNonStatic

<lineEnding>

Sets the line-ending of files after formatting. Valid values are:
  • "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>

Configures whether to remove unused imports.
  • Type: boolean
  • Since: 1.1.0
  • Required: No
  • User Property: impsort.removeUnused
  • Default: false
  • Alias: removeUnused

<skip>

Allows skipping execution of this plugin.
  • Type: boolean
  • Since: 1.0.0
  • Required: No
  • User Property: impsort.skip
  • Default: false
  • Alias: skip

<staticAfter>

Configures whether static groups will appear after non-static groups.
  • Type: boolean
  • Since: 1.0.0
  • Required: No
  • User Property: impsort.staticAfter
  • Default: false
  • Alias: staticAfter

<staticGroups>

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.
  • Type: java.lang.String
  • Since: 1.0.0
  • Required: No
  • User Property: impsort.staticGroups
  • Default: *
  • Alias: staticGroups

<treatSamePackageAsUnused>

Configures whether to treat imports in the current package as unused and subject to removal along with other unused imports.
  • Type: boolean
  • Since: 1.2.0
  • Required: No
  • User Property: impsort.treatSamePackageAsUnused
  • Default: true
  • Alias: treatSamePackageAsUnused