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

查看:675
本文介绍了如何删除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?

推荐答案

快照. 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.

参考:

  • Force maven update
  • maven artifact repository directory structure specs
  • Maven repository layout

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

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