简体   繁体   English

从 Maven 远程存储库中删除版本

[英]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.

相关问题 以编程方式从远程Maven存储库下载工件 - Downloading artifacts from remote maven repo programmatically 带有远程Maven存储库的KieScanner - KieScanner with remote maven repo 使用Maven从文件名中删除版本号 - Removing version number from file name with Maven 使用自定义版本的工件而不是repo中的版本来构建Maven项目 - Building maven project with custom version of artifact instead of the one from repo 在Maven项目中从Alfresco删除远程跟踪图像 - Removing the remote tracking image from Alfresco within a Maven project Artifactory 忽略来自远程(maven 中心)的库版本? - Artifactory ignores version of a library from remote (maven central)? Maven依赖版本不匹配问题 - 从repo解决过时的依赖版本 - Maven dependency version mismatch issue - resolving outdated version of dependency from repo 如何使 maven 从中央仓库下载依赖项。 而不是从远程公司回购下载。? - How to make maven download dependencies from central repo. rather than downloading from remote company repo.? 在不与远程仓库同步的情况下离线使用Maven的最佳方法是什么? - What is the best way to use maven offline without sync with remote repo? Maven /从构建中删除时间戳 - Maven/Removing timestamps from build
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM