1. 程式人生 > >解決mvn clean後打包錯:Cannot create resource output directory

解決mvn clean後打包錯:Cannot create resource output directory

cannot lean ack sof create maven rec 問題: org

今天遇到一個奇怪問題:使用mvn clean後,打包問是出現下面錯。

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:2.6:resources (default-resources) on project inventory: Cannot create resource output directory: E:\work\lanhusoft\cms\target\classes -> [Help 1]
?

maven-resources-plugin:2.5 - Cannot create resource output directory

windows maven clean 目錄還在

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:2
.6:resources (default-resources) on project inventory: Cannot create resource ou
tput directory: E:\work\lanhusoft\cms\target\classes -> [Help 1]
[ERROR]

我們都知道,mvn clean後會把target目錄刪除,mvn clean沒有問題,但是從資源管理器裏面還能看到這個target目錄,打不開,點擊會提示“拒絕訪問”

註銷電腦後,再登錄target目錄不見了,並且能成功打包。

後來找到原因:

原來是之前用壓縮軟件WinRAR查看target裏面war包內容沒有關閉,雖然mvn把target目錄刪除了,但是WinRAR沒有關閉,還占用起那個目錄的。所以在外面還看到這個目錄還在,因此mvn package 一直報錯。

其實就是有進程在占用這個文件

轉自 https://www.lanhusoft.com/article/654.html

解決mvn clean後打包錯:Cannot create resource output directory