简体   繁体   English

清除所有SNAPSHOT依赖项的本地maven存储库

[英]Purge local maven repo of all SNAPSHOT dependencies

I am in an environment where multiple versions of a jar file with the same name can be published to a local Nexus installation. 我所处的环境中,可以将多个版本的同名jar文件发布到本地Nexus安装。 These jar files are always named XYZ-SNAPSHOT.jar. 这些jar文件始终命名为XYZ-SNAPSHOT.jar。 Our continuous integration system needs to always pull the latest version, so our automated build currently contains the following to wipe out the complete local repo on the Continuous Integration machine: 我们的持续集成系统需要始终提取最新版本,因此我们的自动构建目前包含以下内容以消除Continuous Integration机器上的完整本地存储:

mvn dependency:purge-local-repository mvn依赖:purge-local-repository

This forces all dependencies to be downloaded on each build, which makes it take a very long time. 这会强制在每个构建上下载所有依赖项,这会花费很长时间。 Is there some way to use the 'includes' flag with a wildcard. 有没有办法将'includes'标志与通配符一起使用。 Something that I would assume looks like this: 我会假设的东西看起来像这样:

mvn dependency:purge-local-repository -includes="*-SNAPSHOT.jar" mvn依赖:purge-local-repository -includes =“* - SNAPSHOT.jar”

It would also be acceptable to add a new mvn target if that has the necessary flexibility. 如果具有必要的灵活性,添加新的mvn目标也是可以接受的。

Yes there is this flexibility available to filter dependencies also to specify just SNAPSHOTS 是的,这种灵活性可用于过滤依赖性,仅指定SNAPSHOTS

try 尝试

mvn dependency:purge-local-repository -DmanualInclude="com.abc:artifact-id" -DsnapshotsOnly=true

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM