Available in Nexus Repository Pro only
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 Section 6.6, “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 Section 22.1, “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”.
Artifact metadata consists of a key, a value, and a namespace.
Existing metadata from a component’s POM is given a
namespace, and custom attributes are stored under the
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 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".
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
the component classifier is
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:maven/component#test:project:1.0::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
e.g., be attached as an additional project output component with the
build helper maven plugin.
<plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>build-helper-maven-plugin</artifactId> <version>1.7</version> <executions> <execution> <id>attach-components</id> <phase>package</phase> <goals> <goal>attach-component</goal> </goals> <configuration> <artifacts> <artifact> <file>metadata.n3</file> <type>n3</type> <classifier>metadata</classifier> </artifact> </artifacts> </configuration> </execution> </executions> </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.