解决mvn clean后打包错:Cannot create resource output directory

今天遇到一个奇怪问题:使用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

猜你喜欢

转载自www.cnblogs.com/bxssjava/p/10100102.html