执行命令:
mvn clean package -Dmaven.test.skip=true
报错如下:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-clean-plugin:3.0.0
:clean (default-clean) on project demo: Failed to clean project: Failed to delet
e F:\idea-workspace\testjekins\target -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e swit
ch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please rea
d the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionE
xception[ERROR] Failed to execute goal org.apache.maven.plugins:maven-clean-plugin:3.0.0
:clean (default-clean) on project demo: Failed to clean project: Failed to delet
e F:\idea-workspace\testjekins\target -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e swit
ch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please rea
d the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionE
xception
从上面的提示看,清空target文件夹时出错了,但没有更详细的错误信息,
根据提示加上-e参数
mvn clean package -Dmaven.test.skip=true -e
执行结果如下:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-clean-plugin:3.0.0
:clean (default-clean) on project demo: Failed to clean project: Failed to delet
e F:\idea-workspace\testjekins\target -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal o
rg.apache.maven.plugins:maven-clean-plugin:3.0.0:clean (default-clean) on projec
t demo: Failed to clean project: Failed to delete F:\idea-workspace\testjekins\t
arget
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor
.java:216)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor
.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor
.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProje
ct(LifecycleModuleBuilder.java:116)
关键提示:
Failed to delete F:\idea-workspace\testjekins\t
arget
说明删除target文件夹时报错,肯定是有程序占用这个文件夹,或者这个文件夹被打开了,逐一排除,发现是一个dos窗口的当前目录在target文件夹中,如下图:
关闭该dos窗口,再次执行,不在报错了