maven自带clean_maven clean插件使用进阶

本文介绍了Maven的Clean插件,详细讲解了如何使用`mvn clean:help`命令获取帮助信息,以及如何配置插件跳过默认清理和删除特定文件夹。通过设置excludeDefaultDirectories、filesets等参数,可以自定义清理行为,如保留或删除特定目录和文件。
摘要由CSDN通过智能技术生成

maven clean插件使用进阶

参考

查看命令帮助

mvn clean:help

mvn clean:help -Ddetail=true -Dgoal=clean

跳过clean和删除指定的文件夹

org.apache.maven.plugins

maven-clean-plugin

3.1.0

true

src/main/generated

src/main/mozq

*.txt

[INFO] --------------------------------[ jar ]---------------------------------

[INFO]

[INFO] --- maven-clean-plugin:3.1.0:clean (default-clean) @ demo-01 ---

[INFO] Deleting D:\00\mozq_pro1\shiro\demo-01\src\main\generated (includes = [], excludes = [])

[INFO] Deleting D:\00\mozq_pro1\shiro\demo-01\src\main\mozq (includes = [*.txt], excludes = [])

[INFO] ------------------------------------------------------------------------

帮助

Maven Clean Plugin

The Maven Clean Plugin is a plugin that removes files generated at build-time

in a project's directory.

clean:clean

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.

Available parameters:

excludeDefaultDirectories (Default: false)

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.

Expression: ${clean.excludeDefaultDirectories}

failOnError (Default: true)

Indicates whether the build will continue even if there are clean errors.

Expression: ${maven.clean.failOnError}

filesets

The list of file sets to delete, in addition to the default directories.

For example:

src/main/generated

false

true

*.java

Template*

followSymLinks (Default: false)

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.

Expression: ${clean.followSymLinks}

retryOnError (Default: true)

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.

Expression: ${maven.clean.retryOnError}

skip (Default: false)

Disables the plugin execution.

Expression: ${clean.skip}

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 -X).

Expression: ${clean.verbose}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值