在運行Maven項目時報錯
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-clean-plugin:2.5:clean (default-clean) on project taotao-manager-web: Failed to clean project: Failed to delete E:\JAVA\project\taotao-manager\taotao-manager-web\target\tomcat\logs\access_log.2017-07-23 -> [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
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <goals> -rf :taotao-manager-web
錯誤原因是描述中的文件被佔用,無法刪除導致錯誤。關閉Eclipse程序再啓動可解決問題。
但每次反覆關閉程序也不是辦法,之後我找到文件所在位置,手動刪除文件,會提示
接着我通過任務管理器-性能-打開資源監視器-CPU-關聯的句柄中搜索文件
發現是被javaw.exe程序佔用,在任務管理器中強制結束進程也可解決問題。
經查詢後發現大多同樣的問題是IO傳輸文件後未關閉流導致,
根本解決方案爲在每次運行項目後點擊除去啓動 再點擊旁邊紅色的結束按鈕即可
找到對應目錄發現文件已被刪除。