Sonatype Nexus

6 minute readExtensibilityDeveloper productivity

The EC-Nexus plugin is the CloudBees CD/RO integration to the Sonatype Nexus Repository Manager. For more information about Nexus Repository Manager please refer to 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 1.2.1.2021081117

Revised on August 11, 2021

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 apply across some or all of the plugin procedures. They reduce repetition of common values, create predefined parameter sets for end users, and securely store credentials where needed. Each configuration is given a unique name that is entered in designated parameters on procedures that use them.

Creating plugin configurations

To create plugin configurations in CloudBees CD, do these steps:

  • Go to Administration Plugins to open the Plugin Manager.

  • Find the EC-Nexus-1.2.1.2021081117 row.

  • Click Configure to open the Configurations page.

  • Click Create Configuration as per the description of parameters below.

Configuration procedure parameters

ParameterDescription

Configuration

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.

Nexus credentials

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

Debug level

Verbosity level of output.

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

ParameterDescription

Configuration

Previously defined plugin configuration.

Repository

Id of the Nexus repository from which to retrieve artifact.

Repository Format

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

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 etc.,

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

ParameterDescription

Configuration

Previously defined plugin configuration.

Repository

Name of the Nexus repository from which to retrieve artifact.

Repository Format

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

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

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. 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 will 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 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".

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.