Documentation Nexus Repository Manager 2.14

21.2. Developing Plugins

Developing plugins allow you to customize and further enhance the repository manager beyond the features and capabilities offered. This section provides you with the information to begin developing your own plugins.

The preferred way to write plugins is to use Java as the implementation language and Apache Maven as the build system. The Nexus Example Plugins project demonstrates a number of plugin examples for Nexus Repository Manager OSS and Nexus Repository Manager Pro. Further examples are the plugins of Nexus Repository Manager OSS.

The easiest way to create a new plugin project is to replicate a plugin with a similar functionality from these projects. The existing plugins and codebase should be used as examples for your own functionality. Inspect the source code of plugins with similar functionality, and read the JavaDoc documentation for the involved classes.


The Maven archetype nexus-archetype-quickstart is deprecated.

To gain access to all the components needed for your plugin development, you have to proxy the Sonatype grid repository with the URL below:

For some Nexus Repository Manager Pro specific plugins, you might need access to the private grid. We suggest that you work with the support team in this situation.

Set up your project to include inheriting from the parent of all the Nexus Repository Manager OSS plugins with the version you are targeting as displayed in Inheriting from the nexus-plugins Parent.

Inheriting from the nexus-plugins Parent. 



It is best to use the identical version of the parent as the Nexus Repository Manager instance no which you want to run your plugin. When developing a plugin you are using large parts of internals, which are subject to change from one version to another. This same logic applies to any dependencies as well.

A plugin Maven project creates a custom build output file in the form of a zip file that contains all dependencies, in addition to your class files and resources from your plugin and some metadata. Enable this by changing the packaging and adding the bundle plugin listed in nexus-plugin Packaging.

nexus-plugin Packaging. 


Add the dependencies in Adding the Nexus Plugin API and Testsupport to your Maven project pom.xml file, to access the Nexus Plugin API and test support.

Adding the Nexus Plugin API and Testsupport. 


These dependencies pull in a large number of transitive dependencies that expose Nexus Repository Manager functionality and other libraries to your project. Depending on the type of plugin and functionality you aim to create, additional dependencies and other details can be added to this minimal project setup. A large number of further classes is available and can be used as part of your plugin development. Some of these classes are contained in other plugins. If you want to use these, you have to add a dependency to this plugin to your plugin’s pom.xml.

An example is a plugin you create that exposes a REST API for further integrations with tools outside of the repository manager similar to how all other plugins expose a REST API. The dependency to add is displayed in Adding a Dependency to the Nexus Siesta Plugin.

Adding a Dependency to the Nexus Siesta Plugin. 


Nexus Repository Manager Pro, Nexus Repository Manager OSS and plugins use JSR-330 annotations like @javax.inject.Inject and the Google Guice dependency injection framework. Typical classes are @Named and are often a @Singleton . Other components are typically injected via constructor injection as displayed in the example from the virusscan example plugin in Constructor Injection.

Constructor Injection. 

  public VirusScannerRequestProcessor(final EventBus eventBus,
                                      final List<VirusScanner> scanners)
    this.eventBus = Preconditions.checkNotNull(eventBus);
    this.scanners = Preconditions.checkNotNull(scanners);

Your Maven project setup should follow the typical standard directory layout conventions. In addition, static resources such as JavaScript files, images, and CSS should be placed in src/main/resources/static.

Once you have created your Maven project as described above, you can build the plugin with

mvn clean install

A successful build includes the creation of a * file in the target folder. To install your plugin into the repository manager you can extract it into the plugin-repository directory as described in Section 21.1, “Managing Plugins”.