[英]Removing a Version from a Maven Remote Repo
I have currently been working on my first Maven project and have run into some confusion with Maven versioning.我目前一直在研究我的第一个 Maven 项目,并且与 Maven 版本控制有些混淆。 I understand that while developing a new version the SNAPSHOT keyword should be used in the version number.
我了解在开发新版本时,应在版本号中使用 SNAPSHOT 关键字。 I also understand that a non SNAPSHOT version should only be released once.
我也明白非 SNAPSHOT 版本应该只发布一次。
I was wondering if it were possible to delete an old version from a Maven remote repository.我想知道是否可以从 Maven 远程存储库中删除旧版本。 For example, if I don't version want
1.0.2
downloadable anymore, what should I do?例如,如果我不想再下载
1.0.2
版本,我该怎么办?
Additionally, Let's say I am working on version 1.0-SNAPSHOT
.此外,假设我正在开发
1.0-SNAPSHOT
版本。 When I deploy version 1.0
, will the last 1.0-SNAPSHOT
version be deleted/replaced by its non SNAPSHOT counterpart?当我部署版本
1.0
时,最后一个1.0-SNAPSHOT
版本是否会被其非 SNAPSHOT 对应版本删除/替换?
Simple answer to this: A release version (without SNAPSHOT) is immutable.对此的简单回答:发布版本(没有 SNAPSHOT)是不可变的。 This includes it will be kept forever.
这包括它将永远保留。
The reason is:原因是:
If someone uses your version
1.0.2
and you simply can delete it those > builds will fail without an obvious reason.如果有人使用您的
1.0.2
版本,而您只需将其删除,那些 > 构建将在没有明显原因的情况下失败。
One word about the thing you mentioned:关于你提到的事情的一句话:
I also understand that a non SNAPSHOT version should only be released once.
我也明白非 SNAPSHOT 版本应该只发布一次。
You can not release the same version twice.您不能两次发布相同的版本。 Never possible and should never.
永远不可能,也不应该。 This would mean you would override and existing version which changes behaviour.
这意味着您将覆盖改变行为的现有版本。 This could also break other builds.
这也可能会破坏其他构建。
You can take a look at for example https://search.maven.org/artifact/javax.mail/mail you will find artifacts which are more than fifteen years old.例如,您可以查看https://search.maven.org/artifact/javax.mail/mail您会发现超过 15 年的工件。 They will never deleted cause It could be the case that someone is using them.
它们永远不会被删除,因为可能有人正在使用它们。
If you have an issue in your version 1.0.2
just simply create a new version 1.0.3
which fixes the issues.如果您的版本
1.0.2
有问题,只需创建一个新版本1.0.3
即可解决问题。 The version number should follow semantical versioning .版本号应遵循语义版本控制。
If you are running a version 1.0-SNAPSHOT
during development and making a release of it (usually via maven-release-plugin ) during the release of 1.0
usually the 1.0-SNAPSHOT
versions will be automatically deleted.如果您在开发期间运行
1.0-SNAPSHOT
版本并在 1.0 版本期间发布它(通常通过maven-release-plugin ),通常1.0
1.0-SNAPSHOT
版本将被自动删除。 So the 1.0-SNAPSHOT
is no longer available.所以
1.0-SNAPSHOT
不再可用。 This is the default configuration for maven repository managers.这是 maven 存储库管理器的默认配置。
If you use AWS S3 bucket as maven repository there is a brutal workaround.如果您使用 AWS S3 存储桶作为 maven 存储库,则有一个残酷的解决方法。 I've tested it and it works.
我已经对其进行了测试,并且可以正常工作。
You can simply delete release folder eg 1.0.0/
on remote repository.您可以简单地删除远程存储库上的发布文件夹,例如
1.0.0/
。 Fact, it leaves some legacy version
tag in main maven-metadata.xml
but it will be overwritten when you perform next release of this version.事实上,它在主
maven-metadata.xml
中留下了一些旧version
标签,但是当您执行此版本的下一个版本时,它将被覆盖。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.