Repository Management with Nexus

6.11. Nexus Plugins and the REST API

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

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

Once you open the Plugin Console, you will see a list of plugins installed in your Nexus 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.

figs/web/config-plugin-console.png

Figure 6.26. Plugin Console


All the functionality in the Nexus 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.26, “Plugin Console” and displayed in Figure 6.27, “Documentation Website for the Core REST API”

figs/web/config-plugin-core-api-site.png

Figure 6.27. Documentation Website for the Core REST API


You can use the Nexus REST API to integrate Nexus in your external systems.

If your external integration uses Java, or is otherwise JVM based, then you can use the Nexus client using the dependency from Nexus Client Core Dependency for Maven Projects with the version corresponding to your Nexus server version.

Nexus Client Core Dependency for Maven Projects. 

<dependency>
    <groupId>org.sonatype.nexus</groupId>
    <artifactId>nexus-client-core</artifactId>
    <version>2.11.0-02</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 Nexus.

A curl Invocation Loading the List of Users from Nexus. 

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