Nexus plugin

7 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, cb-perl shell (instead of old ec-perl). This means that it needs CloudBees CD/RO agent version 10.3+ in order to work.

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

Required. Unique name for the plugin configuration.

Description

Description for the plugin configuration.

Nexus repository manager endpoint

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

Ignore SSL errors

Turn SSL verification off for instances with self-signed certificates.

Nexus credentials

Required. User name and password used to connect to Nexus Repository Manager.

Debug level

Verbosity level of output.

Nexus Version

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

Test connection?

If checked, the credentials will be checked before the configuration is saved.

HTTP proxy

A proxy that should be used for connections.

Proxy authorization

Username and password for proxy.

Plugin procedures

Retrieve Artifact from Nexus

Retrieves the specified artifact from repository and saves the attributes.

Retrieve Artifact from Nexus parameters

Parameter Description

Configuration

Previously defined plugin configuration.

Repository

Required. Id of the Nexus repository from which to retrieve artifact.

Repository format

Required. Format (for example Maven2, npm, NuGet etc.,) used to store, retrieve and index Components (for example packages, binaries, libraries, containers etc.,)

Group

This parameter applies only when you use either Maven or Raw Repository formats. If using Maven or Raw Repository formats, enter the Group Name, for example org.apache.maven.

Artifact

Required. 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;

Examples: maven-core commons-lang

Latest Maven artifact version?

Retrieve latest version? Nexus supports this functionality only for the Maven repository format.

Version

Version of the artifact or the component to be retrieved from Nexus

Classifier

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

Extension

File extension of artifact or component (e.g., jar, pom, tar.gz)

Destination directory

Destination directory for artifact retrieval. If empty artifact will be retrieved to the current job workspace.

Overwrite?

Overwrite if already exists in destination?

Result property sheet

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

Get Latest Artifact Version

Procedure will get and save the latest artifact’s version to the specified property

Get Latest Artifact Version parameters

Parameter Description

Configuration

Previously defined plugin configuration.

Repository

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

Repository format

Required. This is defaulted to Maven. For this procedure this is currently the only supported repository format.

Group

Group Name of the Maven repository, for example org.apache.maven.

Artifact

Required. Artifact name in Maven format. Example: maven-core.

Classifier

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

Extension

File extension of artifact or component (e.g., jar, pom, tar.gz)

Result property sheet

Required. Name of the Property under which latest version should be saved.

Component Definition

EC-Nexus may be used to define a component in CloudBees CD/RO. To create a component, choose EC-Nexus in the drop-down list for Content Location in component definition.

Samples

Maven

Maven artifact in Nexus 3:

Component Definition:

Finished procedure:

Procedure logs:

    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:

Component Definition:

Finished procedure:

Procedure logs:

    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:

Component Definition:

Finished procedure:

Procedure logs:

    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:

Component Definition:

Finished procedure:

Procedure logs:

    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:

Component Definition:

Finished procedure:

Procedure logs:

    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 was not cached yet. If you are retrieving artifact that already exists at the destination, retrieve will fail because the artifact is missing in the Nexus cache, unless you check the Overwrite parameter.

  • Plugin relies on the status endpoints to assume the version of NXRM. Endpoint service/rest/v1/status is used for NXRM 3 and service/local/outreach/status 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

  • Improved Perl modules loader 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 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 version during extraction of Nexus version.

EC-Nexus 2.1.1

  • Added an automatic Destination Directory creation if it doesn’t exist.

EC-Nexus 2.1.0

  • Added a resource for checking the connection.

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 new agent is required to run this plugin’s procedures.

  • Added an "Ignore SSL errors" flag.

EC-Nexus 1.2.2

  • Fixed downloading snapshots from Nexus v3 repository maven2.

EC-Nexus 1.2.1

  • Fixed support for the new plugin configurations UI.

EC-Nexus 1.2.0

  • Added support for the new plugin configurations.

EC-Nexus 1.1.5

  • Fixed retrieving artifact without a group with RAW format.

EC-Nexus 1.1.4

  • Fixed processing Raw repository type.

EC-Nexus 1.1.3

  • Resolved an issue with empty "Proxy Credential" during using "ectool".

EC-Nexus 1.1.2

  • Plugin now supports downloading files without version in name from the raw repository.

EC-Nexus 1.1.1

  • Fixed an issue when on some old setups EditConfiguration did not work properly.

EC-Nexus 1.1.0

  • Plugin configuration has been improved to support external credentials.

  • Proxy support added.

  • New procedure EditConfiguration introduced.

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

  • Added support for the 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 Maven artifact latest version with an incomplete maven-metadata.xml

  • Renaming to "CloudBees CD/RO".

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.