如何删除 maven 获取的缓存本地工件? [英] How do I remove a cached local artifact that maven fetched?

查看:32
本文介绍了如何删除 maven 获取的缓存本地工件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

运行 maven 命令后,jboss 工件缓存在我的本地存储库 /.m2 中.然而,这是错误的副本,我们已经在本地服务器上更新了我们的工件.如何删除此缓存副本?(除了从 /.m2/repository/org 文件夹中手动删除 jboss 文件夹).是否有 Maven 命令可以这样做?另外,我想知道本地存储库的结构究竟如何,是否以任何方式根据 groupId、artifactId、version (GAV)?

After running maven commands, the jboss artifact sits cached in my local repo /.m2. However, it's the wrong copy, and we have updated our artifactory on the local server. How do I remove this cached copy? (other than manually deleting the jboss folder from the /.m2/repository/org folder). Is there a maven command to do so? Also, I was wondering how exactly the local repository is structured, is it according to groupId, artifactId, version (GAV) in any way?

推荐答案

Snapshot 工件可以通过使用 -U 选项和 mvn 构建具有依赖项的项目时.Maven 将获取指定版本的最新可用快照.您必须先将固定快照工件部署到存储库.最新的快照由附加到 jar 文件名的时间戳决定.

Snapshot artifacts can be force-updated by using -U option with mvn when building a project with the dependency. Maven will take the newest snapshot available of the specified version. You have to deploy the fixed snapshot artifact to the repository before. The newest snapshot is determined by the timestamp attached to the file name of the jar.

但是,发布版本没有更新.下载并验证发布工件后,如果您在远程存储库上替换它,则必须手动将其删除.通常,您应该永远替换发布版本工件.相反,您应该始终发布新版本(并可能从存储库中删除错误版本)并更改使用此工件的项目的 pom.xml 文件.

However, release versions are not updated. Once a release artifact has been downloaded and verified, you must remove it manually if you replaced it on a remote repository. Generally, you should never replace release version artifacts. Rather you should always release a new version (and possibly delete the erroneous version from the repository) and change the pom.xml files of projects which use this artifact.

有关本地/远程存储库的结构,请参阅下面的链接.

For the structure of the local/remote repository, see links below.

参考:

这篇关于如何删除 maven 获取的缓存本地工件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆