解决 Failed to execute goal org.apache.maven.plugins:maven-clean-plugin:2.4.1:clean问题

博客给出一个Maven项目清理失败的案例,报错信息显示无法删除指定目录。解决方法为:先关闭软件,删除target目录下所有文件但保留文件夹,接着更新项目,最后运行Maven构建。

1、案例:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-clean-plugin:2.4.1:clean (default-clean) on project : Failed to clean project: Failed to delete D:\project\target\m2e-wtp\overlays -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 


2、解决:
第一步:关闭软件,删除target目录下所有文件,保留target文件夹
第二步:update project
第三步:run ->maven build

en/2.0.6/maven-2.0.6.pom Downloaded: https://repo.maven.apache.org/maven2/org/apache/maven/maven/2.0.6/maven-2.0.6.pom (9 KB at 17.2 KB/sec) Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/maven-parent/5/maven-parent-5.pom Downloaded: https://repo.maven.apache.org/maven2/org/apache/maven/maven-parent/5/maven-parent-5.pom (15 KB at 27.0 KB/sec) Downloading: https://repo.maven.apache.org/maven2/org/apache/apache/3/apache-3.pom Downloaded: https://repo.maven.apache.org/maven2/org/apache/apache/3/apache-3.pom (4 KB at 6.4 KB/sec) Downloading: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-utils/2.0.5/plexus-utils-2.0.5.pom Downloaded: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-utils/2.0.5/plexus-utils-2.0.5.pom (4 KB at 6.1 KB/sec) Downloading: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus/2.0.6/plexus-2.0.6.pom Downloaded: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus/2.0.6/plexus-2.0.6.pom (17 KB at 31.6 KB/sec) Downloading: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-utils/2.0.5/plexus-utils-2.0.5.jar Downloaded: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-utils/2.0.5/plexus-utils-2.0.5.jar (218 KB at 331.2 KB/sec) [INFO] Deleting /home/ma/hbase-demo/target [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 3:55.554s [INFO] Finished at: Sat Jan 03 13:50:10 CST 2026 [INFO] Final Memory: 15M/84M [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.apache.maven.plugins:maven-clean-plugin:2.4.1:clean (default-clean) on project hbase-demo: Failed to clean project: Failed to delete /home/ma/hbase-demo/target/generated-sources/annotations -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [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 read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException [ma@master hbase-demo]$ 什么情况
01-04
[ma@master hbase-demo]$ su ma 密码: [ma@master hbase-demo]$ cd ~/hbase-demo [ma@master hbase-demo]$ mvn clean package [INFO] Scanning for projects... [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building hbase-demo 1.0-SNAPSHOT [INFO] ------------------------------------------------------------------------ [INFO] [INFO] --- maven-clean-plugin:2.4.1:clean (default-clean) @ hbase-demo --- [INFO] [INFO] --- maven-resources-plugin:2.5:resources (default-resources) @ hbase-demo --- [debug] execute contextualize [WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent! [INFO] Copying 0 resource [INFO] [INFO] --- maven-compiler-plugin:3.8.0:compile (default-compile) @ hbase-demo --- [INFO] Changes detected - recompiling the module! [WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent! [INFO] Compiling 1 source file to /home/ma/hbase-demo/target/classes [INFO] ------------------------------------------------------------- [ERROR] COMPILATION ERROR : [INFO] ------------------------------------------------------------- [ERROR] /home/ma/hbase-demo/src/main/java/HBaseOperation.java:[6,38] 找不到符号 符号: 类 CompareOperator 位置: 程序包 org.apache.hadoop.hbase.filter [ERROR] /home/ma/hbase-demo/src/main/java/HBaseOperation.java:[9,38] 找不到符号 符号: 类 CompareOperator 位置: 程序包 org.apache.hadoop.hbase.filter [INFO] 2 errors [INFO] ------------------------------------------------------------- [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 2.126s [INFO] Finished at: Sat Jan 03 14:00:39 CST 2026 [INFO] Final Memory: 34M/284M [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.0:compile (default-compile) on project hbase-demo: Compilation failure: Compilation failure: [ERROR] /home/ma/hbase-demo/src/main/java/HBaseOperation.java:[6,38] 找不到符号 [ERROR] 符号: 类 CompareOperator [ERROR] 位置: 程序包 org.apache.hadoop.hbase.filter [ERROR] /home/ma/hbase-demo/src/main/java/HBaseOperation.java:[9,38] 找不到符号 [ERROR] 符号: 类 CompareOperator [ERROR] 位置: 程序包 org.apache.hadoop.hbase.filter [ERROR] -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [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 read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException [ma@master hbase-demo]
最新发布
01-04
[INFO] Total time: 9.397 s [INFO] Finished at: 2025-08-07T17:17:32+08:00 [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project ecs-intelligence-monitor-service: Compilation failure: Compilation failure: [ERROR] /D:/work/mywork/newwork/ecs-service/ecs-intelligence-monitor-service/src/main/java/com/esc/intelligence/monitor/task/DataSyncTask.java:[7,43] 程序包com.xxl.job.core.handler.annotation不存在 [ERROR] /D:/work/mywork/newwork/ecs-service/ecs-intelligence-monitor-service/src/main/java/com/esc/intelligence/monitor/config/XxlJobConfig.java:[4,38] 程序包com.xxl.job.core.executor.impl不存在 [ERROR] /D:/work/mywork/newwork/ecs-service/ecs-intelligence-monitor-service/src/main/java/com/esc/intelligence/monitor/config/XxlJobConfig.java:[46,12] 找不到符号 [ERROR] 符号: 类 XxlJobSpringExecutor [ERROR] 位置: 类 com.esc.intelligence.monitor.config.XxlJobConfig [ERROR] /D:/work/mywork/newwork/ecs-service/ecs-intelligence-monitor-service/src/main/java/com/esc/intelligence/monitor/task/DataSyncTask.java:[25,6] 找不到符号 [ERROR] 符号: 类 XxlJob [ERROR] 位置: 类 com.esc.intelligence.monitor.task.DataSyncTask [ERROR] -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [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 read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException [ERROR] [ERROR] After correcting the problems, you can resume the build with the command [ERROR] mvn <args> -rf :ecs-intelligence-monitor-service
08-08
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值