clean:clean
Full name:
org.apache.maven.plugins:maven-clean-plugin:3.2.0:clean
Description:
Goal which cleans the build.
This attempts to clean a project's working directory of the
files that were generated at build-time. By default, it discovers
and deletes the directories configured in
project.build.directory
,
project.build.outputDirectory
,
project.build.testOutputDirectory
, and
project.reporting.outputDirectory
.
Files outside the default may also be included in the deletion
by configuring the filesets
tag.
Attributes:
- Requires a Maven project to be executed.
- The goal is thread-safe and supports parallel builds.
- Since version:
2.0
.
Optional Parameters
Name | Type | Since | Description |
---|---|---|---|
<excludeDefaultDirectories> |
boolean |
2.3 |
Disables the deletion of the default output directories configured
for a project. If set to true , only the
files/directories selected via the parameter filesets
will be deleted. Starting with 3.0.0 the property has been renamed from clean.excludeDefaultDirectories to
maven.clean.excludeDefaultDirectories .Default value is: false .User property is: maven.clean.excludeDefaultDirectories . |
<failOnError> |
boolean |
2.2 |
Indicates whether the build will continue even if there are clean
errors. Default value is: true .User property is: maven.clean.failOnError . |
<fast> |
boolean |
3.2 |
Enables fast clean if possible. If set to true , when
the plugin is executed, a directory to be deleted will be
atomically moved inside the maven.clean.fastDir
directory and a thread will be launched to delete the needed files
in the background. When the build is completed, maven will wait
until all the files have been deleted. If any problem occurs during
the atomic move of the directories, the plugin will default to the
traditional deletion mechanism.Default value is: false .User property is: maven.clean.fast . |
<fastDir> |
File |
3.2 |
When fast clean is specified, the fastDir property
will be used as the location where directories to be deleted will
be moved prior to background deletion. If not specified, the
${maven.multiModuleProjectDirectory}/target/.clean
directory will be used. If the ${build.directory} has
been modified, you'll have to adjust this property explicitly. In
order for fast clean to work correctly, this directory and the
various directories that will be deleted should usually reside on
the same volume. The exact conditions are system dependant though,
but if an atomic move is not supported, the standard deletion
mechanism will be used.User property is: maven.clean.fastDir . |
<fastMode> |
String |
3.2 |
Mode to use when using fast clean. Values are:
background to start deletion immediately and waiting
for all files to be deleted when the session ends,
at-end to indicate that the actual deletion should be
performed synchronously when the session ends, or
defer to specify that the actual file deletion should
be started in the background when the session ends (this should
only be used when maven is embedded in a long running process).Default value is: background .User property is: maven.clean.fastMode . |
<filesets> |
Fileset[] |
2.1 |
The list of file sets to delete, in addition to the default
directories. For example:
<filesets> <fileset> <directory>src/main/generated</directory> <followSymlinks>false</followSymlinks> <useDefaultExcludes>true</useDefaultExcludes> <includes> <include>*.java</include> </includes> <excludes> <exclude>Template*</exclude> </excludes> </fileset> </filesets> |
<followSymLinks> |
boolean |
2.1 |
Sets whether the plugin should follow symbolic links while deleting
files from the default output directories of the project. Not
following symlinks requires more IO operations and heap memory,
regardless whether symlinks are actually present. So projects with
a huge output directory that knowingly does not contain symlinks
can improve performance by setting this parameter to
true . Starting with 3.0.0 the property has been renamed from
clean.followSymLinks to
maven.clean.followSymLinks .Default value is: false .User property is: maven.clean.followSymLinks . |
<retryOnError> |
boolean |
2.4.2 |
Indicates whether the plugin should undertake additional attempts
(after a short delay) to delete a file if the first attempt failed.
This is meant to help deleting files that are temporarily locked by
third-party tools like virus scanners or search indexing. Default value is: true .User property is: maven.clean.retryOnError . |
<skip> |
boolean |
2.2 |
Disables the plugin execution. Starting with 3.0.0 the property has been renamed from
clean.skip to maven.clean.skip .Default value is: false .User property is: maven.clean.skip . |
<verbose> |
Boolean |
2.1 |
Sets whether the plugin runs in verbose mode. As of plugin version
2.3, the default value is derived from Maven's global debug flag
(compare command line switch -X ). Starting with 3.0.0 the property has been renamed from clean.verbose to maven.clean.verbose .User property is: maven.clean.verbose . |
Parameter Details
<excludeDefaultDirectories>
Disables the deletion of the default output directories configured
for a project. If set to
Starting with 3.0.0 the property has been renamed from
true
, only the
files/directories selected via the parameter filesets
will be deleted. Starting with 3.0.0 the property has been renamed from
clean.excludeDefaultDirectories
to
maven.clean.excludeDefaultDirectories
.- Type:
boolean
- Since:
2.3
- Required:
No
- User Property:
maven.clean.excludeDefaultDirectories
- Default:
false
<failOnError>
Indicates whether the build will continue even if there are clean
errors.
- Type:
boolean
- Since:
2.2
- Required:
No
- User Property:
maven.clean.failOnError
- Default:
true
<fast>
Enables fast clean if possible. If set to
true
, when
the plugin is executed, a directory to be deleted will be
atomically moved inside the maven.clean.fastDir
directory and a thread will be launched to delete the needed files
in the background. When the build is completed, maven will wait
until all the files have been deleted. If any problem occurs during
the atomic move of the directories, the plugin will default to the
traditional deletion mechanism.- Type:
boolean
- Since:
3.2
- Required:
No
- User Property:
maven.clean.fast
- Default:
false
<fastDir>
When fast clean is specified, the
fastDir
property
will be used as the location where directories to be deleted will
be moved prior to background deletion. If not specified, the
${maven.multiModuleProjectDirectory}/target/.clean
directory will be used. If the ${build.directory}
has
been modified, you'll have to adjust this property explicitly. In
order for fast clean to work correctly, this directory and the
various directories that will be deleted should usually reside on
the same volume. The exact conditions are system dependant though,
but if an atomic move is not supported, the standard deletion
mechanism will be used.- Type:
java.io.File
- Since:
3.2
- Required:
No
- User Property:
maven.clean.fastDir
<fastMode>
Mode to use when using fast clean. Values are:
background
to start deletion immediately and waiting
for all files to be deleted when the session ends,
at-end
to indicate that the actual deletion should be
performed synchronously when the session ends, or
defer
to specify that the actual file deletion should
be started in the background when the session ends (this should
only be used when maven is embedded in a long running process).- Type:
java.lang.String
- Since:
3.2
- Required:
No
- User Property:
maven.clean.fastMode
- Default:
background
<filesets>
The list of file sets to delete, in addition to the default
directories. For example:
<filesets> <fileset> <directory>src/main/generated</directory> <followSymlinks>false</followSymlinks> <useDefaultExcludes>true</useDefaultExcludes> <includes> <include>*.java</include> </includes> <excludes> <exclude>Template*</exclude> </excludes> </fileset> </filesets>
- Type:
org.apache.maven.plugins.clean.Fileset[]
- Since:
2.1
- Required:
No
<followSymLinks>
Sets whether the plugin should follow symbolic links while deleting
files from the default output directories of the project. Not
following symlinks requires more IO operations and heap memory,
regardless whether symlinks are actually present. So projects with
a huge output directory that knowingly does not contain symlinks
can improve performance by setting this parameter to
Starting with
true
. Starting with
3.0.0
the property has been renamed from
clean.followSymLinks
to
maven.clean.followSymLinks
.- Type:
boolean
- Since:
2.1
- Required:
No
- User Property:
maven.clean.followSymLinks
- Default:
false
<retryOnError>
Indicates whether the plugin should undertake additional attempts
(after a short delay) to delete a file if the first attempt failed.
This is meant to help deleting files that are temporarily locked by
third-party tools like virus scanners or search indexing.
- Type:
boolean
- Since:
2.4.2
- Required:
No
- User Property:
maven.clean.retryOnError
- Default:
true
<skip>
Disables the plugin execution.
Starting with
Starting with
3.0.0
the property has been renamed from
clean.skip
to maven.clean.skip
.- Type:
boolean
- Since:
2.2
- Required:
No
- User Property:
maven.clean.skip
- Default:
false
<verbose>
Sets whether the plugin runs in verbose mode. As of plugin version
2.3, the default value is derived from Maven's global debug flag
(compare command line switch
Starting with 3.0.0 the property has been renamed from
-X
). Starting with 3.0.0 the property has been renamed from
clean.verbose
to maven.clean.verbose
.- Type:
java.lang.Boolean
- Since:
2.1
- Required:
No
- User Property:
maven.clean.verbose