Is there any possibility of deleting libraries sto

2019-08-10 03:07发布

问题:

I am little bit curious on how gradle handles libraries linking in Android studio.I know all these libraries are stored in maven central but lots of people asked me what if those gets deleted or owner deletes his own library from there or may be a particular version that we have already implemented in library.

SO my question here, Is there any possibility of library or any particular version of library will get delete from maven central server?? If yes then i would never able to compile my code?

Anyone has deep knowledge about this?

回答1:

The simple answer to your question is: No.

Artifacts in Maven central will not deleted cause it would could problems as you described which means other peoples build could fail. It is also not possible to change artifacts which are deployed to central. See also the FAQ on Central

Furthermore i would always suggest to use a repository manager which would prevent such situations if it ever will happen which i don't believe, cause it would break the reliability of Maven Central.



回答2:

That's why you want to run your own repository like Nexus or Artifactory (among other reasons). They can act as caching proxy holding downloaded artifacts forever.



回答3:

All libraries in maven central are releases, and should never be deleted. In fact after you released an artifact to any public repository you will never be able to prevent someone to use it for sure. When you use a library from maven central (or any other public repository) for the first time, you download it into a local repository. After this you use the local version even some delete it in the public repo. So if you still have the library in your .maven folder you can still build you project. But someone who never downloaded the library can't after the library is deleted.

But this is all pure theoretically since no one would ever delete any release from maven central. And when you have your own remote repository (what is really recommended) you never should delete any artifact.