Nexus plugin

8 minute readExtensibilityDeveloper productivity

The Nexus plugin is the CloudBees CD/RO integration to the Sonatype Nexus Repository Manager. For more information about Nexus Repository Manager, refer to the Sonatype Nexus documentation:

Nexus 3 provides a well documented REST interface, as such the plugin integration is able to leverage all capabilities of Nexus 3.

This plugin supports all the following repository formats:

  • Maven

  • NPM

  • NuGet

  • RubyGems

  • Raw

Plugin version 2.4.1.2024020640

Revised on February 06, 2024

Updated Perl version required

This plugin is using an updated version of Perl with the cb-perl shell, and requires CloudBees CD/RO agent version 10.3 and later.

Supported versions

  • Nexus Repository Manager OSS 2.14.12

  • Nexus Repository Manager OSS 3.16.1

Plugin configurations

Plugin configurations are sets of parameters that can be applied across some, or all, of the plugin procedures. They can reduce the repetition of common values, create predefined parameter sets, and securely store credentials. Each configuration is given a unique name that is entered in the designated parameter for the plugin procedures that use them.

Creating plugin configurations

To create plugin configurations in CloudBees CD/RO, complete the following steps:

  1. Navigate to DevOps Essentials  Plugin Management  Plugin configurations.

  2. Select Add plugin configuration to create a new configuration.

  3. In the New Configuration window, specify a Name for the configuration.

  4. Select the Project that the configuration belongs to.

  5. Optionally, add a Description for the configuration.

  6. Select the appropriate Plugin for the configuration.

  7. Configure the parameters per the descriptions below.

Configuration procedure parameters

Parameter Description

Configuration

Unique name for the plugin configuration.

Description

Description for the plugin configuration.

Nexus repository manager endpoint

URL to use to connect to a Nexus server. For example, http://10.10.10.10:8081/nexus or http://yourNexusServer.

Ignore SSL errors

If selected, SSL verification is ignored for instances with self-signed certificates.

Nexus credentials

Username and password used to connect to the Nexus Repository Manager.

Debug level

Verbosity level of the output. If Trace is selected, the plugin could expose sensitive data to the logs. Do not use the Trace verbosity level in production.

Nexus Version

The Nexus version to be used by the plugin. If AUTO is selected, the version is automatically determined.

Test connection?

If selected, the credentials are checked before the configuration is saved.

HTTP proxy

A proxy that is used for connections.

Proxy authorization

Username and password for the proxy.

Plugin procedures

Retrieve Artifact from Nexus

Retrieves the specified artifact from the repository and saves the attributes.

Retrieve Artifact from Nexus parameters

Parameter Description

Configuration

Previously defined plugin configuration.

Repository

ID of the Nexus repository from which to the retrieve artifact.

Repository format

Repository format used to store, retrieve, and index components (for example, packages, binaries, libraries, or containers).

Group

This parameter only applies if using Maven, Raw, or Apt repository formats. If using Maven or Raw repository formats, enter the group name (for example, org.apache.maven). If using the Apt repository format, enter a component group value, which is usually a platform type (for example, amd64 or arm64).

Artifact

This should be one of the following, based on the repository format:

  • Artifact name for the Maven format.

  • Filename for a Raw artifact.

  • Component name for other format types.

For example, maven-core or commons-lang.

Latest Maven artifact version?

If selected, the latest Maven version is retrieved. Nexus supports this functionality only for the Maven repository format.

Version

Version of the artifact or component to be retrieved from Nexus. For the Yum repository format, a platform type should be specified if present in the package name. For example, 1.6.1-6.el8_8.1.x86_64.

Classifier

A sequence of literals that identifies the artifact’s classifier.

Extension

File extension of artifact or component (for example, jar, pom, or tar.gz).

Destination directory

Destination directory for artifact retrieval. If left empty, the artifact is retrieved to the current job workspace.

Overwrite?

If selected, the artifact is overwritten if it already exists in the destination.

Result property sheet

Property under which retrieved artifact results are saved. By default, it uses the namespace that starts with /myJob/retrievedArtifactVersions/$[resourceName].

Get Latest Artifact Version

Retrieves and saves the latest artifact’s version to the specified property.

Get Latest Artifact Version parameters

Parameter Description

Configuration

Previously defined plugin configuration.

Repository

Name of the Nexus repository from which to retrieve the artifact.

Repository format

Repository format used to store, retrieve, and index components. Maven is the only supported repository format.

Group

Group name of the Maven repository (for example, org.apache.maven).

Artifact

Artifact name in Maven format (for example, maven-core).

Classifier

A sequence of literals that identifies the artifact’s classifier.

Extension

File extension of the artifact or component (for example, jar, pom, or tar.gz).

Result property sheet

Name of the property under which the latest version should be saved.

Component definition

Use the Nexus plugin to define a component in CloudBees CD/RO. To create a component, select EC-Nexus in the dropdown list for the Content Location in the component definition.

Maven

Maven artifact in Nexus 3
Figure 1. Maven artifact in Nexus 3
Maven component definition
Figure 2. Maven component definition
Finished procedure
Figure 3. Finished procedure

The procedure logs should appear as follows:

Got parameter "artifactId" with value "commons-lang3" Got parameter "classifier" with value "" Got parameter "config" with value "nexus3" Got parameter "destination" with value "/tmp/" Got parameter "extension" with value "" Got parameter "groupId" with value "org.apache.commons" Got parameter "latestVersion" with value "1" Got parameter "overwrite" with value "1" Got parameter "repoType" with value "maven" Got parameter "repository" with value "maven-central" Got parameter "resultPropertySheet" with value "" Got parameter "version" with value "" Result Property Sheet path is : /myJob/retrievedArtifactVersions/local Checking that repository 'maven-central' is accessible Ignore errors: 0 Filename is determined from the asset download URL commons-lang3-3.9.jar Downloading repository/maven-central//org/apache/commons/commons-lang3/3.9/commons-lang3-3.9.jar to /tmp/commons-lang3-3.9.jar. Successfully downloaded the artifact. Receiving attributes for the artifact.

NPM

NPM artifact in Nexus 3
Figure 4. NPM artifact in Nexus 3
NPM component definition
Figure 5. NPM component definition
Finished procedure
Figure 6. Finished procedure

The procedure logs should appear as follows:

Got parameter "artifactId" with value "left-pad" Got parameter "classifier" with value "" Got parameter "config" with value "nexus3" Got parameter "destination" with value "" Got parameter "extension" with value "" Got parameter "groupId" with value "" Got parameter "latestVersion" with value "0" Got parameter "overwrite" with value "1" Got parameter "repoType" with value "npm" Got parameter "repository" with value "npm-proxy" Got parameter "resultPropertySheet" with value "" Got parameter "version" with value "1.2.0" Result Property Sheet path is : /myJob/retrievedArtifactVersions/local Checking that repository 'npm-proxy' is accessible Ignore errors: 0 Filename is determined from the asset download URL left-pad-1.2.0.tgz Downloading repository/npm-proxy//left-pad/-/left-pad-1.2.0.tgz to ./left-pad-1.2.0.tgz. Successfully downloaded the artifact. Receiving attributes for the artifact.

NuGet

NuGet artifact in Nexus 3
Figure 7. NuGet artifact in Nexus 3
Nuget component definition
Figure 8. Nuget component definition
Finished procedure
Figure 9. Finished procedure

The procedure logs should appear as follows:

Got parameter "artifactId" with value "HelloWorld" Got parameter "classifier" with value "" Got parameter "config" with value "nexus3" Got parameter "destination" with value "" Got parameter "extension" with value "" Got parameter "groupId" with value "" Got parameter "latestVersion" with value "0" Got parameter "overwrite" with value "1" Got parameter "repoType" with value "nuget" Got parameter "repository" with value "nuget-private" Got parameter "resultPropertySheet" with value "" Got parameter "version" with value "1.3.0.14" Result Property Sheet path is : /myJob/retrievedArtifactVersions/local Checking that repository 'nuget-private' is accessible Ignore errors: 0 Filename is determined from the asset download URL HelloWorld-1.3.0.14.nupkg Downloading repository/nuget-private//HelloWorld/1.3.0.14 to ./HelloWorld-1.3.0.14.nupkg. Successfully downloaded the artifact. Receiving attributes for the artifact.

Raw

Raw artifact in Nexus 3
Figure 10. Raw artifact in Nexus 3
Raw component definition
Figure 11. Raw component definition
Finished procedure
Figure 12. Finished procedure

The procedure logs should appear as follows:

Got parameter "artifactId" with value "npm-app1-1.1.0.tgz" Got parameter "classifier" with value "" Got parameter "config" with value "nexus3" Got parameter "destination" with value "" Got parameter "extension" with value "" Got parameter "groupId" with value "HelloWorld" Got parameter "latestVersion" with value "0" Got parameter "overwrite" with value "1" Got parameter "repoType" with value "raw" Got parameter "repository" with value "raw-private" Got parameter "resultPropertySheet" with value "" Got parameter "version" with value "1.1.0" Result Property Sheet path is : /myJob/retrievedArtifactVersions/local Checking that repository 'raw-private' is accessible Ignore errors: 0 Filename is determined from the asset download URL npm-app1-1.1.0.tgz Downloading repository/raw-private//HelloWorld/npm-app1-1.1.0.tgz to ./npm-app1-1.1.0.tgz. Successfully downloaded the artifact. Receiving attributes for the artifact. Will not use Version when looking for the artifact. This is Nexus limitation (No version is stored for raw artifacts)

RubyGems

RubyGems artifact in Nexus 3
Figure 13. RubyGems artifact in Nexus 3
RubyGems component definition
Figure 14. RubyGems component definition
Finished procedure
Figure 15. Finished procedure

The procedure logs should appear as follows:

Got parameter "repository" with value "rubygems-proxy" Got parameter "extension" with value "" Got parameter "version" with value "0.1.2" Got parameter "destination" with value "" Got parameter "groupId" with value "" Got parameter "artifactId" with value "hola" Got parameter "repoType" with value "rubygems" Got parameter "overwrite" with value "0" Got parameter "resultPropertySheet" with value "" Got parameter "classifier" with value "" Got parameter "config" with value "nexus3" Got parameter "latestVersion" with value "0" Result Property Sheet path is : /myJob/retrievedArtifactVersions/local Checking that repository 'rubygems-proxy' is accessible Ignore errors: 0 Filename is determined from the asset download URL hola-0.1.2.gem Downloading repository/rubygems-proxy//gems/h/hola-0.1.2.gem to ./hola-0.1.2.gem. Successfully downloaded the artifact. Receiving attributes for the artifact.

Known issues

  • Nexus cannot return information about the remote artifact that has not been cached. If you are retrieving an artifact that already exists at the destination, the retrieval will fail because the artifact is missing in the Nexus cache, unless you select the Overwrite parameter.

  • The Nexus plugin relies on the status endpoints to assume the version of NXRM. The service/rest/v1/status endpoint is used for NXRM 3 and the service/local/outreach/status endpoint is used for NXRM 2.

Release notes

EC-Nexus 2.4.1

  • Improved SSL/TLS certificate validation to ensure that when the Ignore SSL issues parameter is selected that SSL/TLS validation is properly disabled.

EC-Nexus 2.4.0

  • The Perl modules loader has been improved to avoid segmentation faults and deep recursion calls under some circumstances.

EC-Nexus 2.3.0

  • Added Helm repository type support and an error message for Nexus version 2.

  • Added Apt repository type support and an error message for Nexus version 2.

  • Added Yum repository type support and an error message for Nexus version 2.

  • Added PyPi repository type support and an error message for Nexus version 2.

EC-Nexus 2.2.2

  • Added a 5 second delay for group repositories that include proxy repositories. The behavior now mirrors the behavior of simple proxy repositories.

EC-Nexus 2.2.1

  • Updated the plugin description.

EC-Nexus 2.2.0

  • Added a new Nexus Version plugin configuration parameter to manually select the Nexus version, instead of automatically defining it.

  • Added a check for setting up the version during extraction of a Nexus version.

EC-Nexus 2.1.1

  • Added support for automatically creating a destination directory if it did not already exist.

EC-Nexus 2.1.0

  • Added a resource for checking connections.

EC-Nexus 2.0.0

  • Upgraded from perl-5.8 to perl-5.32. No backward compatibility with releases prior 10.3. Starting from this release, a new agent is required to run this plugin’s procedures.

  • Added an Ignore SSL errors parameter to the Nexus plugin configuration.

EC-Nexus 1.2.2

  • Fixed a problem with downloading snapshots from Nexus v3 repositories using Maven 2.

EC-Nexus 1.2.1

  • Fixed support for the new plugin configurations UI.

EC-Nexus 1.2.0

  • Added support for new plugin configurations.

EC-Nexus 1.1.5

  • Fixed artifact retrieval without specifying a group when using Raw repository formats.

EC-Nexus 1.1.4

  • Fixed a problem that occurred when processing Raw repository types.

EC-Nexus 1.1.3

  • Resolved an issue with an empty Proxy Credential when using ectool.

EC-Nexus 1.1.2

  • The Nexus plugin now supports downloading files without specifying a version in the name when using Raw repository types.

EC-Nexus 1.1.1

  • Fixed an issue where some older instances of the EditConfiguration procedure did not work properly.

EC-Nexus 1.1.0

  • The plugin configuration has been improved to support external credentials.

  • Added proxy support.

  • Added support for the EditConfiguration procedure.

  • Enhanced verbosity for the Check Connection step of the CreateConfiguration and EditConfiguration procedures.

  • Added support for uniqueVersion snapshots.

  • Added support for reverse-proxied Nexus hosts.

EC-Nexus 1.0.4

  • The documentation has been migrated to the main documentation site.

EC-Nexus 1.0.3

  • Added support for resolving the Maven artifact latest version with an incomplete maven-metadata.xml.

  • Renamed to "CloudBees CD".

EC-Nexus 1.0.2

  • Fixed retrieving Maven artifacts with a snapshot version.

EC-Nexus 1.0.1

  • Renamed to "CloudBees".

EC-Nexus 1.0.0

  • Initial release.