Proxy repository VS hosted repository

霸气de小男生 提交于 2021-02-07 05:39:07

问题


According to Nexus book, hosted repository is "a repository that is hosted by Nexus." and the 3rd party repository (a hosted repository) should be used for third-party dependencies not available in the public Maven repositories.

What's the difference between hosted repository and proxy repository? For example, JBoss release is referenced as a proxy repository. Why isn't JBoss release a 3rd party repository? Does it really matter to define it as a hosted repository or proxy repository?


回答1:


I'm not sure what you don't find clear in the Nexus Book. The short version is, a proxy repository is one that you are mirroring, and a hosted repository is one that you host on your server through the Nexus software. Hosted includes third party libraries that aren't public for some reason, see below.

6.2.1. Proxy Repository

A Proxy Repository is a proxy of a remote repository. By default, Nexus ships with the following configured proxy repositories:

Apache Snapshots

This repository contains snapshot releases from the Apache Software Foundation.

Codehaus Snapshots

This repository contains snapshot releases from Codehaus.

Central

This is the Central Repository containing release components. Formerly known as Maven Central, it is the default built-in repository for Apache Maven and directly supported in other build tools like Gradle, SBT or Ant/Ivy. Nexus connects to the Central Repository via HTTPS using the URL https://repo1.maven.org/maven2/.

6.2.2. Hosted Repository

A Hosted Repository is a repository that is hosted by Nexus. Nexus ships with the following configured hosted repositories:

3rd Party

This hosted repository should be used for third-party dependencies not available in the public Maven repositories. Examples of these dependencies could be commercial, proprietary libraries such as an Oracle JDBC driver that may be referenced by your organization.

Releases

This hosted repository is where your organization will publish internal releases.

Snapshots

This hosted repository is where your organization will publish internal snapshots.




回答2:


Quoting from the Nexus Book:

1. Proxy Repository

  • Is a repository with the type proxy, also known as a proxy repository, is a repository that is linked to a remote repository.
  • Any request for a component is verified against the local content of the proxy repository. If no local component is found, the request is forwarded to the remote repository. The component is then retrieved and stored locally in the repository manager, which acts as a cache.
  • Subsequent requests for the same component are then fulfilled from the local storage, therefore eliminating the network bandwidth and time overhead of retrieving the component from the remote repository again.

  • By default, the repository manager ships with the following configured proxy repositories:

    a). maven-central - Proxy repository accesses the Central Repository, formerly known as Maven Central.

    b). nuget.org-proxy - This proxy repository accesses the NuGet Gallery. It is the default component repository used by the nuget package management tool used for .Net development.


2. Hosted Repository

  • A repository with the type hosted, also known as a hosted repository, is a repository that stores components in the repository manager as the authoritative location for these components.

  • By default, the repository manager ships with the following configured hosted repositories:

    a). maven-releases - This hosted repository uses the maven2 repository format with a release version policy. It is intended to be the repository where your organization publishes internal releases. You can also use this repository for third-party components that are not available in external repositories and can therefore not be retrieved via a configured proxy repository.

    b). maven-snapshots - Uses the maven2 repository format with a snapshot version policy. It is intended to be the the repository where your organization publishes internal development versions, also known as snapshots.

    c). nuget-hosted - It is intended to be the the repository where your organization can publish internal releases in repository using the NuGet repository format.




回答3:


it's not easy to understand them only by term, take company A for example, company A has a own artifact companyA.jar, it depends on mybatis.jar, when building companyA project, it will download mybatis.jar from proxy repository, if there is not, then nexus will download it from public maven repository and store it in proxy repository such that it not necessary for nexus download mybatis from public maven repository again.

For companyA project, other developers needs it too in this company, so its developer needs to deploy it to hosted repository such that other people can use it.



来源:https://stackoverflow.com/questions/31901423/proxy-repository-vs-hosted-repository

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