maven 打包报错,target无法删除Failed to clean project: Failed to delete D:\*\target

clean (default-clean) on project ****: Failed to clean project: Failed to delete D:***\项目模块名\target

报错原因:怀疑是自己最近刚使用的热部署插件JReble插件的锅,因为自己以前都是以debug的形式,也是最近才接触,对他也是不是很熟悉;

刚开始的时候,自己也只是批量删除每个模块下的target文件夹,重新打包后,就可以执行成功;

后来发现,单纯的删除文件并不能完全解决问题,在stackoverflow上找到几个方案;

  1. 关闭目标文件夹及其打开的文件,关闭idea,关闭进程java.exe

  2. 关闭自动编译

maven 打包报错,target无法删除Failed to clean project: Failed to delete D:\*\target_第1张图片

  1. maven命令添加 -Dmaven.clean.failOnError=false
    使用命令行参数-Dmaven.clean.failOnError = false调用clean

    http://maven.apache.org/plugins/maven-clean-plugin/faq.html

maven 打包报错,target无法删除Failed to clean project: Failed to delete D:\*\target_第2张图片

你可能感兴趣的:(maven 打包报错,target无法删除Failed to clean project: Failed to delete D:\*\target)