Removing an artifact from Maven Central

帅比萌擦擦* 提交于 2019-11-27 21:57:43

Can't be done. It's A Rule. But if you want to try, contact the Sonatype people who support oss.sonatype.org. So you generally push a new, higher, version with the fix, and tell everyone to use it.

If you accidentally distributed an artifact which does not work or has bug or whatever the usual solution in Maven is to create a new version which fixes the problems. That's it. Deleting in Maven Central is not be done and shouldn't ever happen.

You can't remove an artifact from Maven Central because others might have used it already. Maven will not check for updates for non-snapshot versions of artifacts, so if someone has used the old version and a new version was uploaded, those people would never see the new version.

The workaround is to release a new version of your artifact.

It's hard to resist the urge to just release the staged repository (it's only a click away), but as suggested in the Sonatype OSS Usage Guide

You will want to download them and do some manual testing (or hold a community vote) before finally releasing them.

If it's the first time you've released, then you'll have to comment on your OSS Sonatype JIRA ticket to get Central synch activated. Presumably this is an opportunity to say "Wait! This artifact is broken. Please please please don't synch it to Maven Central!" :)

But as others have said, if it's released then it's too late - you'll have to release a new version (and ensure your users are aware not to use the broken one).

Beta releases are a good idea for new/major releases - people are a bit more forgiving if you've stuffed something up, and you don't lose your desired version number.

If you don't want to create a new version, another solution would be to push the fixed artifact under the same version.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!