如何轻松地从本地存储库中删除所有过时的快照?
我的 repo 中的许多文件导致性能不佳,并且获取 Artifact 的时间很长。我想将 repo 精简到最新的快照。
我看到了 dependency:purge-local-repository可以清除本地存储库,但我想保持最新状态。
我可以轻松创建一个脚本来完成这项工作(并将其包装在一个插件中),但如果已经有一个工具可以清除到最新版本,我不想重新发明轮子。
是否有插件可以清除我对最新快照或最后 X 快照的依赖项?
最佳答案
这类似于 how-do-you-deal-with-maven-3-timestamped-snapshots-efficiently
我添加了以下内容,每个构建的包都会清除旧快照,保持我的本地存储库修剪并确保在 Windows 上构建更快
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<id>remove-old-artifacts</id>
<phase>package</phase>
<goals>
<goal>remove-project-artifact</goal>
</goals>
<configuration>
<removeAll>true</removeAll><!-- remove all versions of built artifacts including all versions. Install phase will regenerate -->
</configuration>
</execution>
</executions>
</plugin>
关于maven - 清除 Maven 本地存储库并保持最新?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12572037/