I am trying to delete old artifacts and the directory they live in from my .m2/repository directory. For example I have several versions of projectA: 4.7.0.222, 4.7.0.223, 4.7.0.224 etc. I only need to keep 4.7.0.224 project since it is the latest build.
How can I remove the older 2 versions 4.7.0.222 and 4.7.0.223 without manually deleting them? I have tried this command:
mvn dependency:purge-local-repository -DreResolve=false -DactTransitively=false -Dverbose=true
When I was in those project directories, everything was successful, but the items still remained. Does maven have any commands that are similar to a full linux "rm -rf" or No?
答案 0 :(得分:1)
<强>依赖性:吹扫本地存储库强>
[...]
此目标旨在从本地存储库中删除当前项目(或多个模块构建的项目)的所有依赖项。
[...]
[...]
要清除所有给定 groupId 的依赖关系,请使用
resolutionFuzziness
配置参数。如果既未指定include也未指定exlude,则清除当前项目的所有依赖项。
[...]
- 文件 - 只删除工件的文件。
- 版本 - 删除包含此工件的版本目录。
- artifactId - 删除包含此工件的artifactId目录。
- groupId - 删除包含此工件的groupId目录结构。
要添加不删除 [...] 工件的限制,请将
exclude
参数添加为逗号分隔的groupId:artifactId对列表。