Managing Repositories

To manage repositories, log in as the administrative user and click on Repositories in the Views/Repositories menu in the left-hand main menu.  

Nexus Repository Manager provides for three different kinds of repositories: Proxy repositories, Hosted repositories and Virtual repositories.

Proxy Repository

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

Apache Snapshots

This repository contains snapshot releases from the Apache Software Foundation

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 Repository Manager connects to the Central Repository via HTTPS using the URL https://repo1.maven.org/maven2/.

Hosted Repository

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

3rd Party

This hosted repository can 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 can publish internal Maven releases

Snapshots

This hosted repository is where your organization can publish internal Maven snapshots

Virtual Repository

A Virtual Repository serves as an adaptor to and from different types of repositories. Currently, Nexus Repository Manager Pro supports conversion to and from Maven 1 repositories and Maven 2 repositories. In addition, you can expose any repository format as a NuGet or OBR repository. For example, a Maven 2 repository can contain OSGi Bundles, which can be exposed as a OSGi Bundle repository with the virtual repository Provider set to OBR.  By default it ships with a Central M1 shadow repository that exposes the Central repository in Maven 1 format.

Configuring Repositories

The Repositories window displayed in Figure 6.9, “Repository Configuration Screen for a Proxy Repository” allows you to create and delete different repositories with the Add and  Delete buttons, as well as update repositories. Use the Refresh button to update the displayed list of repositories and repository groups. The Trash button allows you to empy the trash folder into which deleted components are copied, when any delete operations are performed from the user interface.

By default, the list of repositories displays the repositories configured and managed by the administrator. The drop down on the right of the Trash button allows you to switch the list of repositories and view the repositories managed by the repository manager. There are staging repositories as documented in Staging Releases or procurement repositories as documented in Procurement Suite.

Figure 6.9. Repository Configuration Screen for a Proxy Repository

The list of repositories visible in Figure 6.9, “Repository Configuration Screen for a Proxy Repository” allows you to access more details for each repository by selecting a specific row which displays some information for each repository in the following columns:

Repository

the name of the repository with repository groups displayed in bold

Type

the type of the repository with values of proxy, hosted or virtual for repositories or group for a repository group

Health Check

the result counts for a repository health check

Format

the format used for the storage in the repository with values such as maven2nugetsite

Policy

the deployment policy that applies to this repository. A policy applies only to Maven 1 and Maven 2 formatted repositories and allows usage of a Snapshot or a Release policy.

Repository Status

the status of the repository as well as further information about the status. For example, information about SSL certification problems or the status of the remote repository even for a currently disabled proxy repository

Repository Path

the direct URL path that exposes the repository via HTTP access and potentially allows access and directory browsing outside of the user interface

Clicking on a column header allows you to sort the list in ascending or descending order based on the column data.

If you right-click on a row, you can trigger a number of actions on the current repository, depending on the repository type. Actions include:

Expire Cache

expire the cache of hosted or a proxy repository or a repository group

Rebuild Metadata

rebuild the metadata of a hosted Maven 2 repository

Block Proxy / Allow Proxy

toggle between allowing or blocking the remote repository configured in a proxy repository

Put Out Of Service / Put in Service

enable or disable the repository service to allow changing the availability of all components in it

Repair Index / Update Index

repair or update the index of a hosted or proxy repository or a repository group

Figure 6.10. Additional Configuration for a Proxy Repository

Figure 6.11. Repository Configuration Access Settings for a Hosted Repository

The bottom of Figure 6.9, “Repository Configuration Screen for a Proxy Repository” and Figure 6.10, “Additional Configuration for a Proxy Repository” combined show the repository configuration screen for a proxy repository in the repository manager. From this screen, you can manage the settings for proxying an external repository as follows:

Repository ID

The repository ID is the identifier that will be used in the URL. For example, the proxy repository for the Central Repository has an ID of central, this means that Maven and other tools can access the repository directly at http://localhost:8081/nexus/content/repositories/central. The Repository ID must be unique in a given repository manager installation and is required.

Repository Name

The display name for a repository which is required

Repository Type

The type of repository (proxy, hosted, or virtual). You can’t change the type of a repository as it is selected when you create a repository.

Provider (and Format)

Provider (and Format) define in what format the repository manager exposes the repository to external tools. The Format is auto-generated by the selection made in the Provider field and is not editable on its own. Nexus Repository Manager OSS includes support for Maven 1, Maven 2, npm, NuGet, Rubygems and Site repositories. Nexus Repository Manager Pro adds support for OBR as well as P2 and P2 Update Site proxies.

Repository Policy

If a proxy repository has a policy of release, then it will only access released versions from the remote repository. If a proxy repository has a policy of snapshot, it will only download snapshots from the remote repository.

Default Storage Location

Not editable, shown for reference. This is the default storage location for the local cached contents of the repository.

Override Storage Location

You can choose to override the storage location for a specific repository. You would do this if you were concerned about storage and wanted to put the contents of a specific repository (such as central) in a different location.

Remote Repository Access

This section configures proxy repositories and how the repository manager interacts with the remote repository, that is being proxied.

Remote Storage Location

The Remote Storage Location needs to be configured with the URL of the remote repository that needs to be proxied. When selecting the URL to proxy, it is beneficial to avoid proxying remote repository groups. Proxying repository groups prevents some performance optimization in terms of accessing and retrieving the content of the remote repository. If you require components from the group that are found in different hosted repositories on the remote repository server it is better to create multiple proxy repositories that proxy the different hosted repositories from the remote server on your repository manager instead of simply proxying the group.

Download Remote Indexes

Downloading the index of a remote repository can be configured with this setting. If enabled, the repository manager will download the index, if it exists, and use that for its searches as well as serve that up to any clients that ask for the index (like m2eclipse). The default for new proxy repositories is enabled, but all of the default repositories included have this option disabled. To change this setting for one of the proxy repositories that ships with the repository manager, change the option, save the repository, and then re-index the repository. Once this is done, component search will return every component available.

Auto Blocking Enabled

If Auto Blocking Enabled is set to True, the repository manager will automatically block a proxy repository if the remote repository becomes unavailable. While a proxy repository is blocked, components will still be served to clients from a local cache, but the repository manager will not attempt to locate a component in a remote repository. The repository manager will periodically retest the remote repository and unblock the repository once it becomes available.

File Content Validation

If set to True, the repository manager will perform a lightweight check on the content of downloaded files. This will prevent what the repository manager believes to be invalid content to be stored and proxied by the repository manager for that format.  For example, in cases where the remote repository (or some proxy between the repository manager and the remote repository) returns a HTML page instead of the requested file.

Checksum Policy

Sets the checksum policy for a remote repository. This option is set to Warn by default. The possible values of this setting are:

      • Ignore - Ignore the checksums entirely
      • Warn - Print a warning in the log if a checksum is not correct
      • StrictIfExists - Refuse to cache a component if the calculated checksum is inconsistent with a checksum in the repository. Only perform this check if the checksum file is present.
      • Strict - Refuse to cache a component if the calculated checksum is inconsistent or if there is no checksum for a component

Authentication

This section allows you to set a Username, Password, NT LAN Host, and NT Lan Manager Domain for a remote repository.

Access Settings

This section allows for the detailed configuration of access to a repository.

Deployment Policy

This setting controls how a Hosted repository allows or disallows component deployment. If this policy is set to Read Only , no deployment is allowed. If this policy is set to Disable Redeploy , a client can only deploy a particular component once and any attempt to redeploy an component will result in an error. If this policy is set to Allow Redeploy , clients can deploy components to this repository and overwrite the same component in subsequent deployments. This option is visible for hosted repositories as shown in Figure 6.11, “Repository Configuration Access Settings for a Hosted Repository” .

Allow File Browsing

When set to True, users can browse the contents of the repository with a web browser

Include in Search

When set to True, this repository is included when you perform a search in the repository manager. If this setting is False, the contents of the repository are excluded from a search.

Publish URL

If this property is set to False, the repository will not be published on a URL, and you will not be able to access this repository remotely. You would set this configuration property to False if you want to prevent clients for connecting to this repository directly.

Expiration Settings

The repository manager maintains a local cache of components and metadata, you can configure expiration parameters for a proxy repository. The expiration settings are:

Not Found Cache TTL

If the repository manager fails to locate a component, it will cache this result for a given number of minutes. In other words, if the repository manager can’t find a component in a remote repository, it will not perform repeated attempts to resolve this component until the Not Found Cache TTL time has been exceeded. The default for this setting is 1440 minutes (or 24 hours).

Artifact Max Age

Tells the repository manager what that maximum age of a component is, before it retrieves a new version from the remote repository. The default for this setting is -1 for a repository with a release policy and 1440 for a repository with snapshot policy.

Metadata Max Age

The repository manager retrieves metadata from the remote repository. It will only retrieve updates to metadata after the Metadata Max Age has been exceeded. The default value for this setting is 1440 minutes (or 24 hours).

Item Max Age

Some items in a repository may be neither a component identified by the Maven GAV coordinates or metadata for such components. This cache value determines the maximum age for these items before updates are retrieved.

HTTP Request Settings

In the HTTP Request Settings you can change the properties of the HTTP request to the remote repository. You can also configure the User Agent of the request, add parameters to a request, and set the timeout and retry behavior. The HTTP request configured is the request made from the repository manager to the remote repository being proxied.

Beyond these configurations in the user interface, Nexus Repository Manager supports the usage of cookies for remote repositories authentication. Together with the feature to enable circular redirects, this enables proxying repositories like the Oracle Maven repository. The following configuration can be added to nexus.properties and allows a functioning proxy repository to the URL https://maven.oracle.com.

# Comma separated list of hostnames that needs to accept circular redirections
nexus.remoteStorage.enableCircularRedirectsForHosts=maven.oracle.com
# Comma separated list of hostnames that benefit from using cookies
nexus.remoteStorage.useCookiesForHosts=maven.oracle.com

Viewing the Summary Panel for a Repository

The Summary panel can be loaded by selecting a hosted, proxy or virtual repository and then clicking on the Summary tab. The Summary tab of a hosted repository, as shown in Figure 6.12, “Repository Summary Panel for a Hosted Repository”, displays the distributionManagement settings that can be used to configure Maven to publish components to the hosted repository.

Figure 6.12. Repository Summary Panel for a Hosted Repository

The Summary panel for a proxy repository, as shown in Figure 6.13, “Repository Summary Panel for a Proxy Repository”, contains all of the repository identifiers and configuration as well as a list of groups in which the repository is contained.

Figure 6.13. Repository Summary Panel for a Proxy Repository

The Summary panel for a virtual repository, as shown in Figure 6.14, “Repository Summary Panel for a Virtual Repository”, displays repository identifiers and configuration as well as the groups in which the repository is contained.

Figure 6.14. Repository Summary Panel for a Virtual Repository

Auto Block/Unblock of Remote Repositories

What happens when the repository manager is unable to reach a remote repository? If you’ve defined a proxy repository and the remote repository is unavailable, the repository manager will now automatically block the remote repository. Once a repository has been auto-blocked, the repository manager will then periodically retest the remote repository and unblock the repository once it becomes available. You can control this behavior by changing the Auto Blocking Enabled setting under the Remote Repository Access section of the proxy repository configuration as shown in the following figure to True:

Figure 6.15. Configuring Remote Repository Auto Block/Unblock