问题
I'm working with some external libraries, and I stumbled across a thought this morning : what if the publisher removes his library from JCenter, Maven Central, etc...? (I'll just focus on those 2 main repo.)
According to this and some other researches, Maven Central seems to save libraries and you are unable to delete something.
However, for JCenter, I was unable to find an accurate answer. So I created my own Bintray account, created a package and pushed some library to it. Then I linked it to JCenter by clicking this button (and waiting to be accepter 6 hours later, why though? (legit question)):
Now that I had a library accesible from an Android Studio project with Jcenter, I tried to mess around within the Bintray account.
Coming from this thread and the documentation, I should be able to delete some things, and make my whole package disappear. The only thing I'm able to do is delete account, complete package or version. I didn't tested it yet because according to the thread, JCenter would create a copy of it that I would have no control over if you don't unlink it. However, I couldn't delete one file manually in a version as they do in the docs, neither could I "unlink" JCenter from my package as they do in the thread.
So, I have multiple questions:
- Is all of this necessary?
- Is it possible that something could be deleted?
- Should I do a copy of every library I use locally (and also make a copy of every library's dependencies)?
- What is going on with JCenter between what people tell and what I see?
回答1:
Jcenter was designed to be immutable as it serves many users that depend on its packages.
Once a package is linked to jcenter it is there to stay.
If the owner deletes the package, bintray makes sure it stays available by claiming ownership (creating a copy of the package to be owned by jcenter).
The best practice would be to link your package to jcenter only after the code in your versions is production ready. The initial inclusion is a one off process. Once you have been granted your own path namespace in jcenter any new version you will publish will automatically appear in jcenter.
After publishing files/versions to bintray you have 180 days of grace to delete them. After that they become immutable and cannot be deleted.
You can also delete a specific file or version from a linked package if you are still in the grace period but you will be damaging your reputation as an oss publisher! since people will be importing those versions from jcenter and you will be breaking their code. this is considered bad practice.
Hope this helps.
来源:https://stackoverflow.com/questions/45588342/can-i-remove-a-library-from-jcenter