I just sync'd an artifact to Maven Central from oss.sonatype.org. Immediately after doing so, a problem was discovered (of course). I haven't announced the new artifact yet, it is very unlikely that anyone is using it yet, so I'd like to take it down before anyone starts using the broken version.
How can I remove a broken artifact from Maven Central?
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.
来源:https://stackoverflow.com/questions/9789611/removing-an-artifact-from-maven-central