Maven plugin

4 minute readExtensibilityDeveloper productivity

Maven is a software project management and comprehension tool based on the project object model (POM). Maven can manage the build process, reporting, and documentation of a project from a central piece of information.

For more information, go to http://maven.apache.org/.

CloudBees CD/RO integration to Maven

The EC-Maven plugin calls the Maven tool through a command line interface and passes the user-provided parameters. It includes the most important features provided by the Maven tool. This plugin allows the input of any command with additional functional and configuration options, completely integrating Maven with CloudBees CD/RO.

CloudBees CD/RO provides advantages including checking parameters, using check boxes or radio buttons to easily select functional options, generating historical log reports and procedure duration statistics, attaching simple credentials, and generating real-time analysis of the log.

Plugin version 3.0.1

Revised on November 03, 2022

Overview

The EC-Maven plugin calls the Maven tool through a command line interface and passes user-provided parameters. It includes the most important features provided by the Maven tool. This plugin allows the input of any command with additional functional and configuration options, completely integrating Maven with CloudBees CD/RO.

CloudBees CD/RO provides advantages including checking parameters, using check boxes or radio buttons to easily select functional options, generating historical log reports and procedure duration statistics, attaching simple credentials, and generating real-time analysis of the log.

Supported versions

The plugin has been tested with the following versions:

  • Maven version 3.8.6.

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 name

Required. The name for the created configuration.

Description

The configuration description.

Server URL

Required. URL of maven repository, for example, https://repo.spring.io/.

Login as

Credentials for Basic authentication (optional).

Check Connection?

If checked, the connection endpoint and credentials entered as part of the configuration will be tested. If this option is checked, configuration will not be saved if the test fails.

Plugin procedures

Retrieve Artifact

Retrieve an artifact from a maven repository.

Retrieve Artifact parameters

Parameter Description

Configuration name

Required. The unique name for the configuration.

Configuration Name

Previously defined configuration for the plugin

Public Server URL

URL of public maven repository, for example, https://repo.spring.io/.

This value must be in the configuration or in a procedure step.

Repository

Required. Name of maven repository, for example, repo.

Artifact

Required. ID of artifact to be retrieved, in form of :, for example, org.apache.activemq:activemq-all.

Classifier

Artifact classifier.

Version

Artifact version. If left empty, get the latest version.

Artifact Extension

Required. Artifact type extension, for example, .jar, .txt.

Retrieve to Directory

Directory to retrieve artifact to. Defaults to workspace directory.

Overwrite

Overwrite file if it exists.

Retrieved Artifact Location Property

Name of property sheet path used by the step to create a property sheet. This property sheet stores information about the retrieved artifact version, including its location in the file system.

runMaven

run Maven command

runMaven parameters

Parameter Description

Working Directory

Required. Provide the directory where the Maven project is located. There should be a pom.xml file properly configured in this location.

Command

Required. Provide the Maven command to execute.

Environment Variables

Set Environment variables during the step execution using perl syntax.

Errors

Produces execution error messages. (This is the command-line --errors option)

Debug

Produces execution debug output. (This is the command-line --debug option)

Never Fail

Never fails the build, regardless of the project result. (This is the command-line --fail-never option)

Fast Fail

Stops at first failure in reactorized builds. (This is the command-line --fail-fast option)

Fail at the end

Only fails the build afterwards; allow all non-impacted builds to continue. (This is the command-line -fail-at-end option)

Additional Options

Add any valid Maven option to the command.

Using runMaven

image
Output

This is an example of a log file:

image

This is an example of the CloudBees CD/RO summary information:

image

Use cases

Retrieval with snapshot

Artifactory can look like below:

image

With maven-metadata.xml:

image

Component configuration for this artifact can look like below:

image

Log for the artifact retrieval:

image

Debug log

To enable debug log, create property for the plugin EC-Maven-3.0.1:

ectool setProperty /projects/EC-Maven-3.0.1/debugLevel 2

The higher log level, the more data comes to the job logs.

Release notes

EC-Maven 3.0.1

  • Fixed an issue with backward compatibility.

EC-Maven 3.0.0

  • Plugin has been migrated from GWT to PDK.

EC-Maven 2.5.0

  • Add support for a new plugin configuration in EC-Maven.

EC-Maven 2.4.9

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

EC-Maven 2.4.8

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

EC-Maven 2.4.7

  • Renaming to "CloudBees CD/RO".

EC-Maven 2.4.6

  • Renaming to "CloudBees"

EC-Maven 2.4.5

  • Configurations can be created by users with "@" sign in a name.

EC-Maven 2.4.4

  • The plugin icon has been updated.

EC-Maven 2.4.3

  • Fixed Retrieve Artifact from Artifactory procedure:

Retrieval logic for snapshots in "Retrieve Artifact from Artifactory" procedure has been fixed to use both the extension and the build number, during comparison with Maven metadata.

EC-Maven 2.4.2

  • Fixed snapshot retrieval logic for qualifier with hyphen.

EC-Maven 2.4.1

  • Added system tests for the plugin.

EC-Maven 2.4.0

  • Added "Retrieved Artifact Location Property" parameter to the "Retrieve Artifact" procedure.

EC-Maven 2.3.3

  • Added use cases to the documentation.

  • Added debug output.

EC-Maven 2.3.2

  • Fixed issue with configurations being cached for IE.

  • Select input field, when associated radio button was clicked.

EC-Maven 2.3.1

  • Added link to plugin Configuration Page in plugin step panels.

  • Renamed ElectricCommander to CloudBees CD/RO.

EC-Maven 2.3.0

  • Bumping version number for Flow 5.4 release

EC-Maven 2.2.2

  • The plugin determines the latest version of the artifact from the versions node instead of the latest node in the XML file from Maven.

  • Minor Retrieve Artifact step UI change (allow selection only for one repository configuration options).

EC-Maven 2.2.1

  • Added the Classifier parameter to the Retrieve Artifact procedure.

  • The Retrieve Artifact procedure fails if CloudBees CD/RO cannot determine the latest version of the artifact.

  • Added support to retrieve snapshots.

  • Added support for basic authentication.

  • CloudBees now retains the configuration across plugin upgrades.

EC-Maven 2.1.1

  • CloudBees CD/RO now validates the artifact server URL.

EC-Maven 2.1.0

  • Added support to retrieve artifacts from the Artifactory and Nexus repository servers.

EC-Maven 2.0.6

  • Added environment variables to the Retrieve Artifact procedure.

  • Improved the postp matchers.

  • Improved the Command parameter in the runMaven procedure.

EC-Maven 2.0.5

  • Included test results in summary.

EC-Maven 2.0.4

  • Changed the procedure names.

EC-Maven 2.0.3

  • Improved the Help document.

EC-Maven 2.0.2

  • Implemented new XML panel parameters.

  • Reformatted the Help document.