purge-local-repository实际上清除了什么? [英] What does purge-local-repository actually purge?

查看:1213
本文介绍了purge-local-repository实际上清除了什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在maven项目目录中运行以下命令:

I am running the following command from within a maven project directory:

mvn dependency:purge-local-repository

预期的行为是什么?

它会删除(并重新下载?)在我的本地存储库中为该特定项目 (即我所在的目录)已经存在的所有依赖项,还是会删除所有我的本地存储库的内容?

Will it delete (and re-download?) all the dependencies already existing in my local repo for that particular project (i.e. whose directory I am in) or will it delete all the contents of my local repo?

推荐答案

默认情况下,

By default, purge-local-repository will remove from the local repository all the files associated to the version of each dependency (including transitive) of the project it is ran on:

从本地存储库中删除项目依赖项,并有选择地重新解析它们.

Remove the project dependencies from the local repository, and optionally re-resolve them.

起作用的几个因素是:

  • 默认情况下,插件会清除传递依赖项;这可以通过 actTransitively 参数.
  • 默认情况下,将从本地存储库中清除的所有工件重新解析;这可以通过 reResolve 参数.
  • 从本地存储库中清除的实际文件与与清除的工件版本相关联的所有文件相对应.例如,如果清除了依赖项foo:bar:1.0,则路径foo/bar/1.0/*下的所有文件都将被删除.可通过 resolutionFuzziness 参数(其默认值为version):
    • artifactId将清除要清除的工件的工件ID路径下的所有文件.在上面的示例中,将清除foo/bar/**下的所有文件(因此,所有版本都将被删除).
    • groupId将清除路径下的所有文件,以清除要清除的工件的组ID.在上面的示例中,将清除foo/**下的所有文件(因此,将删除所有工件ID的所有版本).
    • file只会清除要清除的工件的文件.在上面的示例中,仅文件bar-1.0.jar*将被删除(这包括它们可能具有的所有sha1).它不会清除关联的POM文件.
    • Transitive dependencies are purged by the plugin by default; this is configurable through the actTransitively parameter.
    • All of the purged artifacts from the local repository are re-resolved by default; this is configurable through the reResolve parameter.
    • The actual files that are purged from the local repository correspond to all the files associated to the version of the purged artifact. For example, if the dependency foo:bar:1.0 is purged, all the files under the path foo/bar/1.0/* will be removed. This is configurable through the resolutionFuzziness parameter (whose default value is version):
      • A value of artifactId would purge all the files under the path to artifact id of the artifact being purged. In the example above, all files under foo/bar/** would be purged (so, all versions are removed).
      • A value of groupId would purge all the files under the path to group id of the artifact being purged. In the example above, all files under foo/** would be purged (so, all versions for all artifact ids are removed).
      • A value of file would only purge the file for the artifact being purged. In the example above, only the files bar-1.0.jar* will be removed (this includes any sha1 they could have). It would not purge the associated POM file.

      通过使用

      You can see which artifacts are going to be purged by printing the list of all dependencies for the project with the list goal:

      mvn dependency:list
      

      (可选)将 excludeTransitive 添加到如果您决定不清除传递性依赖项,则此命令.

      optionally adding excludeTransitive to this command, if you decide not to purge transitive dependencies.

      这篇关于purge-local-repository实际上清除了什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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