寻找用于快照构建(磁盘空间)的 Maven 存储库清理脚本(unix)
所以我们有自己的私有 Maven 存储库,我们将快照版本发布到其中。
我们有很多构建,因此磁盘空间开始成为我们所有快照构建的问题。虽然这很有趣并且需要手动执行此操作,但我想知道是否有人知道我可以运行来执行快照清理的 CRON 脚本。
我知道 sonatype 为他们自己的存储库执行此操作,但我找不到脚本。
So we have our own private Maven repository that we publish snapshot builds to.
We have lots builds so diskspace is starting to become a problem for all our snapshot builds. While its fun and all to go manually do this I was wondering if anyone knows of a CRON script that I can run to do the snapshot cleanup.
I know sonatype does this for their own repo but I could not find a script.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
要查找两周前更新的所有快照文件:
将其通过管道传输到 xargs rm ,您应该就可以了。
需要注意的是:存储库管理器将创建一个
metadata.xml
文件,其中列出所有已发布的修订版本。假设您只是使用scp
进行发布,并使用网络服务器进行检索,我认为该文件不存在(因此该脚本不接触它的事实不应该成为问题)。To find all snapshot files that were updated more than two weeks ago:
Pipe that to
xargs rm
and you should be good.The one caveat: a repository manager will create a
metadata.xml
file that lists all published revisions. Assuming that you're just usingscp
to publish, and a webserver to retrieve, I don't think that file exists (so the fact that this script doesn't touch it shouldn't be an issue).以下脚本对我来说效果很好:
The following script works fine for me: