Skip to main content

Plugins and the REST API for Nexus Repository 2

Nexus Repository 2

As documented in Managing Plugins, Nexus Repository Manager is built as a collection of plugins supported by a core architecture and additional plugins can be installed.

You can use the Plugin Console to list all installed plugins and browse REST services made available by the installed plugins. To open the Plugin Console, click on the Plugin Console link in the Administration menu in the left-hand main menu.

Once you open the Plugin Console, you will see a list of plugins installed in your repository manager installation. Clicking on a plugin in this list will display information about the plugin including name, version, status, a description, SCM information about the plugin and the URL of the plugin’s project web site and links to the plugin documentation.

5410485.png

Figure 6.24. Plugin Console

All the functionality in the user interface is accessing the REST API’s provided by the different plugins. An example for the plugin documentation is the main documentation for the core Nexus API linked off the Nexus Restlet 1.x Plugin from Figure 6.24, “Plugin Console” and displayed in Figure 6.25, “Documentation Website for the Core REST API”:

5410484.png

Figure 6.25. Documentation Website for the Core REST API

You can use the REST API to integrate the repository manager with your external systems. If your external integration uses Java, or is otherwise JVM based, then you can use the Nexus Repository Manager client using the dependency from Nexus Client Core Dependency for Maven Projects with the version corresponding to your repository manager version.

Nexus Client Core Dependency for Maven Projects

<dependency>
    <groupId>org.sonatype.nexus</groupId>
    <artifactId>nexus-client-core</artifactId>
    <version>2.12.1-01</version>
</dependency>

Examples of using the client library can be found in the Nexus Maven Plugins or the Nexus Ant Tasks.

The REST API can be invoked from many other programming and scripting languages. A simple example of using the curl command in a shell script is displayed in A curl Invocation Loading the List of Users from the repository manager.

A curl Invocation Loading the List of Users from the repository manager

curl -X GET -u admin:admin123 http://localhost:8081/nexus/service/local/users