Support for custom metadata for components in Maven 2 repositories is part of Nexus Professional. You can view, edit, and search for additional metadata associated to any artifact in your Nexus 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 2.7 custom metadata support was an optional plugin that needed to be installed, following the instructions in Section 22.1, “Managing Nexus 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 artifact 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 an artifact’s POM is given a
namespace, and custom attributes are stored under the
To add a custom attribute, click on an artifact in Nexus, 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 artifact’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 into Nexus using an xml file. The file will be processed as artifact metadata if it meets the following criteria:
file extension is
the artifact classifier is
Here are example contents of a metadata file which adds additional custom metadata to an artifact with GAV of "test:project:1.0" and packaging of "jar":
<urn:maven/artifact#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 artifact 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-artifacts</id> <phase>package</phase> <goals> <goal>attach-artifact</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 Nexus 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.