Skip to main content

Viewing and Editing Artifact Metadata in Nexus Repository 2

Nexus Repository 2


Only available in Sonatype Nexus Repository Pro. Interested in a free trial? Start here.

Support for custom metadata for components in Maven 2 repositories is part of Nexus Repository Manager Pro. You can view, edit, and search for additional metadata associated to any component in your repositories.

The features for custom metadata usage need to be activated by adding and enabling the Custom Metadata capability as described in Accessing and Configuring Capabilities.

Prior to Nexus Repository Manager Pro 2.7 custom metadata support was an optional plugin that needed to be installed, following the instructions in Managing Plugins. The directory containing the plugin code is called nexus-custom-metadata-plugin-X.Y.Z. Install the plugin

Security privileges allow you to define "read only" as well as "write" access for custom metadata as well as grant or disallow access. When viewing a specific component from browsing repository storage or a repository index or from a search, the Artifact Metadata tab displays the interface shown in Figure 5.8, “Viewing Artifact Metadata”.


Figure 5.8. Viewing Artifact Metadata

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

To add a custom attribute, click on a component, and select the Artifact Metadata tab. Click Add… there and a new row will be inserted into the list of attributes. Supply a Key and a Value and click Save to update the component’s metadata. Figure 5.9, “Editing Artifact Metadata” shows the Artifact Metadata panel with two custom attributes: approvedBy and approved.


Figure 5.9. Editing Artifact Metadata

You can upload custom metadata data using an xml file. The file will be processed as component metadata if it meets the following criteria:

  • file extension is .n3 or .xml

  • the component classifier is metadata

Here are example contents of a metadata file which adds additional custom metadata to a component with GAV of test:project:1.0 and packaging of jar:

    <urn:mycustomspace#repositoryId> "releases" ;
    <urn:mycustomspace#mavenVersion> "2.2.1" ;
    <urn:mycustomspace#releaseManager> "myusername" ;
    <urn:mycustomspace#codeCoverage> ".99" .

A file with the above metadata content and a name of metadata.n3 can e.g., be attached as an additional project output component with the build helper maven plugin.


The metadata in the file is consumed by the custom metadata plugin and becomes available in the user interface for inspection and search. By default this metadata available for read operations only. If the repository deployment policy allows redeploys, the custom metadata can be changed.