Repository Management with Nexus
Repository Management with Nexus

5.2. Browsing Repositories

One of the most straightforward uses of the Nexus is to browse the structure of a Maven repository. If you click on the Browse Repositories menu item in the Views menu, you should see the following display. The top-half of Figure 5.2, “Browsing a Nexus Repository” shows you a list of groups and repositories along with the type of the repository and the repository status. To browse the artifacts that are stored in a local Nexus instance, click on the Browse Storage tab for a repository as shown in Figure 5.2, “Browsing a Nexus Repository”.

figs/web/repository-manager_browse-repositories.png

Figure 5.2. Browsing a Nexus Repository


When you are browsing a repository, you can right click on any file and download it directly to your browser. This allows you to retrieve specific artifacts manually, or examine a POM file in the browser.

Note

When browsing a remote repository you might notice that the tree doesn’t contain all of the artifacts in a repository. When you browse a proxy repository, Nexus is displaying the artifacts which have been cached locally from the remote repository. If you don’t see an artifact you expected to see through Nexus, it only means that Nexus has yet to cache the artifact locally. If you have enabled remote repository index downloads, Nexus will return search results that may include artifacts not yet downloaded from the remote repository. Figure 5.2, “Browsing a Nexus Repository”, is just an example, and you may or may not have the doxia-core artifact available in your installation of Nexus.

A Nexus proxy repository acts as a local cache for a remote repository, in addition to downloading and caching artifacts locally, Nexus will also download an index of all the artifacts stored in a particular repository. When searching or browsing for artifacts, it is often more useful to search and browse the repository index. To view the repository index, click on the Browse Index tab for a particular repository to load the interface shown in Figure 5.3, “Browsing a Nexus Repository Index”.

figs/web/repository-manager_browse-repository-index.png

Figure 5.3. Browsing a Nexus Repository Index


As shown in Figure 5.3, “Browsing a Nexus Repository Index”, if an artifact has been downloaded from a remote repository and cached in Nexus, the artifact or folder will display a small Nexus logo.

5.2.1. View Artifact Dependencies

Nexus Professional provides you with the ability to browse an artifact’s dependencies. Using the artifact metadata found in an artifact’s POM, Nexus will scan a repository or a repository group and attempt to resolve and display an artifact’s dependencies. To view an artifact’s dependencies, browse the repository storage or the repository index, select an artifact (or an artifact’s POM), and then click on the Maven Dependency tab.

On the Maven Dependency tab, you will see the following form elements:

Repository
When resolving an artifact’s dependencies, Nexus will query an existing repository or repository group. In many cases it will make sense to select the same repository group you are referencing in your Maven Settings. If you encounter any problems during the dependency resolution, you need to make sure that you are referencing a repository or a group which contains these dependencies.
Mode
An artifact’s dependencies can be list as either a tree or a list. When dependencies are displayed in a tree, you can inspect direct dependencies and transitive dependencies. This can come in handy if you are assessing an artifact based on the dependencies it is going to pull into your project’s build. When you list dependencies as a list, Nexus is going to perform the same process used by Maven to collapse a tree of dependencies into a list of dependencies using rules to merge and override dependency versions if there are any overlaps or conflicts.

Once you have selected a repository to resolve against and a mode to display an artifact’s dependencies, click on the Resolve button as shown in Figure 5.4, “View an Artifact’s Dependencies”. Clicking on this button will start the process of resolving dependencies, depending on the number of artifacts already cached by Nexus, this process can take anywhere from a few seconds to minute. Once the resolution process is finished, you should see the artifact’s dependencies as shown in Figure 5.4, “View an Artifact’s Dependencies”.

figs/web/using_dependencies.png

Figure 5.4. View an Artifact’s Dependencies


Once you have resolved an artifact’s dependencies, you can double click on a row in the tree or list of dependencies to navigate to other artifacts within the Nexus interface.

5.2.2. Viewing Artifact Metadata

Nexus Professional gives you the ability to view artifact metadata. When browsing repository storage or a repository index, clicking on an artifact will load the Artifact Information panel. Selecting the Artifact Metadata tab will display the interface shown in Figure 5.5, “Viewing Artifact Metadata”.

figs/web/meta_existing-meta-value.png

Figure 5.5. Viewing Artifact Metadata


Artifact metadata consists of a key, a value, and a namespace. Existing metadata from an artifact’s POM is given a urn:maven namespace, and custom attributes are stored under the urn:nexus/user namespace.

5.2.3. Editing Artifact Metadata

Nexus Professional gives you the ability to add custom attributes to artifact metadata. To add a custom attribute, click on an artifact in Nexus, and select the Artifact Metadata tab. On the Artifact Metadata tab, click on the Add… button and a new row will be inserted into the list of attributes. Supply a key and value and click the Save button to update an artifact’s metadata. Figure 5.6, “Editing Artifact Metadata” shows the Artifact Metadata panel with two custom attributes: "approvedBy" and "approved".

figs/web/meta_setting-meta-value.png

Figure 5.6. Editing Artifact Metadata


Sonatype Promotion Subscribe via RSS