我们在开发maven项目的时候,会经常开发打包,执行maven的指令:clean、install等。当有的时候我们执行maven的clean指令时,控制台会报如标题的一个错误,这篇文章讲解下怎么解决这个问题。
正文:1.我的控制台错误日志是这样的
[INFO] Scanning for projects... [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building xxxx.xxxx 1.1.0.0 [INFO] ------------------------------------------------------------------------ [INFO] [INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ xx-xxxxxx --- [INFO] Deleting F:xxx_xxxxxx-xxxxxxxtarget [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 1.382 s [INFO] Finished at: 2019-09-04T15:48:03+08:00 [INFO] Final Memory: 5M/245M [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.apache.maven.plugins:maven-clean-plugin:2.5:clean (default-clean) on project xxxx-xxxxxx: Failed to clean project: Failed to delete F:xxxx_xxxxxxx-xxtargetsurefirexxxxx.jar -> [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
2.我们可以从日志中很清楚的看到,Failed to clean project: Failed to delete 某某jar包,然后我们可以在进到这个目录下手动删除这个jar包试试
会发现错误已经很明显了,只要你在windows系统下删过东西,应该经常碰到类似意思的提示,就会说因为程序在占用你要删除的这个东西,所以删除不了,一般只要把占用这个文件的程序关闭就可以啦。
3.我们进到电脑的任务管理器,然后选中这个进程,点击右下角的结束任务就可以啦
Ctrl+Alt+Delete
4.我们再一次进行maven的clean指令,发现就可以clean成功
针对这个问题这是我目前想到的解决方案,也许不是最好的,希望大家如果发现新的办法,及时留言,我会在实际操作验证后,更新解决方案。
我是阿达,一名喜欢分享知识的程序员,时不时的也会荒腔走板的聊一聊电影、电视剧、音乐、漫画,这里将来会有N位小伙伴在等你们,感兴趣的就赶紧来点击关注我把,哪里有不明白或有不同观点的地方欢迎留言。



