Repository Management with Nexus
20.3. Custom Metadata Plugin

20.3. Custom Metadata Plugin

The custom metadata plugin is an optional plugin that comes as part of any Nexus download. It allows you to view, edit and search for additional metadata about any artifact in your Nexus repositories.

The directory containing the plugin code is called nexus-custom-metadata-plugin-X.Y.Z. Install the plugin following the instructions in Section 20.1, “Installing Additional Plugins”.

20.3.1. Viewing Artifact Metadata

The Custom Metadata Plugin 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 20.1, “Viewing Artifact Metadata”.

figs/web/meta_existing-meta-value.png

Figure 20.1. 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.

20.3.2. Editing Artifact Metadata

The Custom Metadata Plugin 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 20.2, “Editing Artifact Metadata” shows the Artifact Metadata panel with two custom attributes: "approvedBy" and "approved".

figs/web/meta_setting-meta-value.png

Figure 20.2. Editing Artifact Metadata


20.3.3. Searching Artifact Metadata

The Custom Metadata Plugin provides you with the ability to configure custom artifact metadata and search for artifacts with specific metadata. To search for artifacts using metadata, click on the Advanced Search link directly below the search field in the Nexus application menu to open the Search panel. Once in the search panel, click on the Keyword Search and click on Metadata Search in the search type drop-down as shown in Figure 20.3, “Searching Artifact Metadata”.

figs/web/meta_search-selection.png

Figure 20.3. Searching Artifact Metadata


Once you select the Metadata Search you will see two search fields and an operator drop-down. The two search fields are the key and value of the metadata you are searching for. The key corresponds to the key of the metadata you are searching for, and the value contains the value or value range you are searching for. The operator drop-down can be set to Equals, Matches, Bounded, or Not Equal.

figs/web/meta_search-function.png

Figure 20.4. Metadata Search Results for Custom Metadata


Once you locate a matching artifact in the Metadata Search interface, click on the artifact and then select the Artifact Metadata to examine an artifacts metadata as shown in Figure 20.5, “Metadata Search Results for Custom Metadata”.

figs/web/meta_search-result-0.png

Figure 20.5. Metadata Search Results for Custom Metadata