Maven

5 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 2.4.8.2020092501


Revised on May 7, 2020

Integrated version

This plugin was developed and tested against Maven version 2.2.1.

Setting up the plugin configuration

For all parameter descriptions below, required parameters are in bold italics.

Input

Plugin configurations are sets of parameters that apply across some or all of the plugin procedures. They reduce repetition of common values, create predefined sets of parameters for end users, and store credentials securely. Each configuration has a unique name that is automatically entered in designated parameters in the procedures.

  1. Go to Administration > Plugins to open the Plugin Manager.

  2. Find the EC-Maven row.

  3. Click Configure to open the Maven Configurations page.

  4. Click Create Configuration.

  5. To enable CloudBees CD to communicate with your JBoss AS, enter the following information. You may need to create additional configurations later, especially when using standalone and domain servers, because they use different port numbers.

Output

The Maven Configurations page now shows the new configuration.

Plugin procedures

Retrieve artifact

This procedure retrieves an artifact from Artifactory or the Nexus Maven repository.

Input

  1. Go to the Retrieve Artifact procedure.

  2. Enter the following parameters:

ParameterDescription

Configuration Name

The name of an existing Maven configuration.

Public Server URL

The URL of the public (without authentication) Artifactory or Nexus server, such as http://repo.spring.io/.

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

Repository

The name of the Artifactory or Nexus repository, such as repo.

Artifact

The ID of artifact to retrieve, in form of artifact group:_artifact key_, such as org.apache.activemq:activemq-all.

Version

The version of artifact to retrieve.

Select Latest for latest version.

Select Exact and enter the specific version, such as 4.0.

For a snapshot retrieval, specify the snapshot version, e.g. 1.0-SNAPSHOT, and the plugin will look for maven-metadata.xml descriptor in the snapshot directory for the full version.

Classifier

The classifier for the artifact.

Artifact Extension

The type of the artifact extension, such as .jar or .txt.

Retrieve to Directory

The directory where CloudBees CD put the artifact after it is retrieved. The default is the workspace directory.

Overwrite

Select this to overwrite the 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. The following data will be saved under the property sheet:

filename, e.g. MyArtifact-1.0.0.jar

destination - full path to the artifact in the file system, e.g. /tmp/MyArtifact-1.0.0.jar

version - artifact version, e.g. 1.0.0

artifactUrl - URL, which was used to download the artifact.

Output

After the job runs, you can view the results on the Job Details page. In the Retrieve Artifact step, click the Log icon to see the diagnostic information.

Retrieved artifact properties:

RunMaven

This procedure allows the input of all the necessary parameters and additional ones to make the tool more configurable. When the parameters are defined, the Maven command or script is created and run in CloudBees CD, which displays the results. The results include a summary of the selected source directories, classPath, total execution time, memory statistics, and a log file containing the output generated by the console.

Input

  1. Go to the runMaven procedure.

  2. Enter the following parameters:

ParameterDescription

Working Directory

Specify the directory where the Maven project is located. It has a file called POM.xml.

Command

Enter the Maven command or script to run.

Environment Variables

Set the environment variables that CloudBees CD uses to run the procedure step. Use the perl syntax to set the environment variables (for example, $ENV{PATH}=$ENV{PATH}.";%USERPROFILE%\\bin";).

Errors

Select this parameter to generate execution error messages. This is the command-line --errors option.

Debug

Select this parameter to generate execution debug output. This is the command-line --debug option.

Never Fail

Select this parameter to set the build to never fail, regardless of the project result. This is the command-line --fail-never option.

Fast Fail

Select this parameter to stop the build at the first failure in reactorized builds. This is the command-line --fail-fast option.

Fail at the end

Select this parameter to set the build to fail after all the builds run. All builds that were not affected by the failed build continue to run. This is the command-line --fail-at-end option.

Additional Options

Enter any valid Maven options to the command.

Output

This is an example of a log file:

This is an example of the CloudBees CD summary information:

Use cases

Retrieval with snapshot

Artifactory can look like below:

With maven-metadata.xml:

Component configuration for this artifact can look like below:

Log for the artifact retrieval:

Debug log

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

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

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

Release notes

EC-Maven 2.4.8

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

EC-Maven 2.4.7

  • Renaming to "CloudBees CD".

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 (July 15, 2015)

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

  • Renamed ElectricCommander to CloudBees CD.

EC-Maven-2.3.0 (April 15, 2015)

  • Bumping version number for Flow 5.4 release

EC-Maven-2.2.2 (February 24, 2015)

  • 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 (January 27, 2015)

  • Added the Classifier parameter to the Retrieve Artifact procedure.

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

  • Added support to retrieve snapshots.

  • Added support for basic authentication.

  • CloudBees CD now retains the configuration across plugin upgrades.

EC-Maven-2.1.1 (October 2014)

  • CloudBees CD now validates the artifact server URL.

EC-Maven-2.1.0 (August 2014)

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

EC-Maven-2.0.6 (May 2012)

  • 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 (May 2012)

  • Included test results in summary.

EC-Maven-2.0.4 (April 2012)

  • 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.