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 depende
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.
Quoting from the Nexus Book:
repository with the type proxy
, also known as a proxy repository, is a repository that is linked to a remote repository. 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.
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
.
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.