• Documentation
  • Tutorials
  • Case studies
  • Blogs
  • Product

What's on this Page

  • Integration
    • Integration with Step Enterprise Edition
  • Usage
    • Executing an Automation Package in Step
    • Deploying an Automation Package to Step
    • Uploading Keywords to Step (deprecated)
  • step
  • DevOps
  • Maven plugin
Categories: DEVELOPER GUIDE CI CD DEV OPS ENTERPRISE
This article references one of our previous releases, click here to go to our latest version instead.

Maven plugin

The Step Maven plugin serves as Command Line Interface (CLI) for all operations related to Automation Packages. It provides an integration with the Step server and an easy way to integrate Step with a CI/CD pipeline.

The Step Maven plugin supports following operations:

  • Upload an Automation Package to Step and execute the contained plans in an isolated context
  • Deploy the content of an Automation Package to Step, thus making available all contained keywords, plans, etc., and enable the contained schedules

For compatibility reason it still supports following operation for the legacy Keyword packages

  • Deploy a Keyword Package to Step during the package phase (deprecated)

You can choose to integrate the plugin goals during the package phase or any later phase as you see fit in the Maven Lifecycle.

Integration

To include the Step plugin in your project you need to add the appropriate dependency to the <pluginManagement> section in your pom.xml.

<build>
    <pluginManagement>
        <plugins>
            <plugin>
                <groupId>ch.exense.step</groupId>
                <artifactId>step-maven-plugin</artifactId>
                <version>${step.plugin.version}</version>
            </plugin>
        </plugins>
    </pluginManagement>
</build>  

You can list the available plugin goals by calling the following command (in the folder of a maven project including the step-maven-plugin):

mvn step:help

To display the parameters of some plugin goal you can use the following command:

mvn step:help -Ddetail=true -Dgoal=goal-name

Once you have declared the plugin in the <pluginManagement> section, you can use it as any common Maven plugin: call a plugin goal directly from the command line, or bind a goal to a phase of the maven lifecycle (using the <plugins> section of the pom.xml file).

Integration with Step Enterprise Edition

The maven plugin supports the following optional features which are required to communicate with Step Enterprise, but should be left empty for Step Open Source:

  • Authentication: the plugin allows to configure the API token which is used to authenticate to Step
  • Project selection (multitenancy): because a user can have access to several projects in Step, the EE version allows to select the target project for deploying and running packages

Optional When triggering an execution on Step, an error summary is collected at the end of the execution in case of failure. To read error reports related to enterprise specific features an additional dependency reserved to Enterprise customer is required.

<pluginRepositories>
  <pluginRepository>
    <id>nexus-exense</id>
    <url>https://nexus-enterprise.exense.ch/repository/exense/</url>
  </pluginRepository>
</pluginRepositories>

<build>
  <pluginManagement>
    <plugins>
      <!-- Make the Step maven plugin available -->
      <plugin>
        <groupId>ch.exense.step</groupId>
        <artifactId>step-maven-plugin</artifactId>
        <version>${step.version}</version>
        <!-- adding dependencies to reports nodes for enterprise artefacts, only required to read errors that may occur during isolated executions -->
          <dependencies>
              <dependency>
                  <groupId>ch.exense.step-enterprise</groupId>
                  <artifactId>step-maven-plugin-ee-extensions</artifactId>
                  <version>${step.version}</version>
              </dependency>
          </dependencies>
      </plugin>
    </plugins>
  </pluginManagement>
</build>

Usage

Detailed descriptions of the goals are provided below.

Executing an Automation Package in Step

The maven goal execute-automation-package runs (executes) the plans contained in an Automation Package (which was built as a part of current maven project), on a one-off basis, and in an ephemeral context that is destroyed afterward. In other words, the Automation Package and its contents are not made permanently available on the server, but exist only temporarily during the execution.

Property (xml) Command Line Alias Description Required Default Value
url step.url The URL of running Step server true
stepProjectName step.step-project-name The name of the target project in Step (Step Enterprise only) false
authToken step.auth-token The authentication token issued by the Step server (Step Enterprise only) false
userId step-execute-auto-packages.user-id The user id used for starting the execution false user of the authentication token
groupId step-execute-auto-packages.group-id The group id of the maven artifact false ${project.groupId}
artifactId step-execute-auto-packages.artifact-id The id of the maven artifact false ${project.artifactId}
artifactVersion step-execute-auto-packages.artifact-version The version of the maven artifact false ${project.version}
artifactClassifier step-execute-auto-packages.artifact-classifier The classifier of the maven artifact (jar, jar-with-dependencies, tests etc) false no classifier
executionParameters step-execute-auto-packages.execution-parameters The execution parameters to be set for the execution false
waitForExecution step-execute-auto-packages.wait-for-exec If this value is ‘false’, the execution is started asynchronously and the maven lifecyle continues without waiting the execution result. If this value is ’true’, the maven lifecycle is suspended until the execution is finished false true
executionResultTimeoutS step-execute-auto-packages.exec-result-timeout-s If the value of waitForExecution is true, this timeout (in seconds) is applied for running execution false 30
ensureExecutionSuccess step-execute-auto-packages.ensure-exec-success If the value of waitForExecution is true, the plugin will analyze the execution result and stop the maven lifecycle if this results is not successful false true
includePlans step-execute-auto-packages.include-plans Comma-separated list of plans to include in execution false all plans
excludePlans step-execute-auto-packages.exclude-plans Comma-separated list of plans to exclude from execution false none

Example:

<plugin>
  <groupId>ch.exense.step</groupId>
  <artifactId>step-maven-plugin</artifactId>
  <executions>
    <execution>
      <id>run-automation-package-in-step</id>
      <phase>package</phase>
      <configuration>
        <url>http://localhost:4201</url>
        <stepProjectName>Common</stepProjectName>
        <authToken>eyJhbGciO.....iJIUzI</authToken>
        <executionParameters>
          <env>PROD</env>
          <PARAM_EXEC>Value</PARAM_EXEC>
          <PARAM_EXEC2>Value</PARAM_EXEC2>
        </executionParameters>
      </configuration>
      <goals>
          <goal>execute-automation-package</goal>
      </goals>
    </execution>
  </executions>  
</plugin>

To call the plugin from the command line you can use the following command:

mvn step:execute-automation-package "-Dstep.url=https://your.step.server/" "-Dstep.step-project-name=Common" "-Dstep.auth-token=yourtoken"

Deploying an Automation Package to Step

The maven goal deploy-automation-package deploys an Automation Package on a Step Server. The deployment makes available (and activates) all content contained in the Automation Package, such as keywords, plans, schedules, etc.

Contrary to the aforementioned execute-automation-package goal, this goal does not immediately execute any plans. However, it enables all schedules contained in the package (if any), so executions may start to be triggered as soon as the package is uploaded. These executions are then considered to be part of the normal operation of Step, not part of the deployment process.
Property (xml) Command Line Alias Description Required Default Value
url step.url The URL of running Step server true
stepProjectName step.step-project-name The name of the target project in Step false
authToken step.auth-token The authentication token issued by Step server false
artifactClassifier step-deploy-automation-package.artifact-classifier The classifier of the maven artifact (jar, jar-with-dependencies, tests etc) false no classifier
async step-deploy-automation-package.async Updating an existing package while executions based on it are running will be delayed until these executions end. Whith this property set to true, the plugin will not wait in case of delayed updates false false

<plugin>
  <groupId>ch.exense.step</groupId>
  <artifactId>step-maven-plugin</artifactId>
  <executions>
    <execution>
      <id>deployed-automation-package-in-step</id>
      <phase>deploy</phase>
      <configuration>
        <url>http://localhost:4201</url>
        <stepProjectName>Common</stepProjectName>
        <authToken>eyJhbGciO.....iJIUzI</authToken>
      </configuration>
      <goals>
          <goal>deploy-automation-package</goal>
      </goals>
    </execution>
  </executions>  
</plugin>

To call the plugin from command line you can use the following command from the maven module where you have the deployed artifact with step Automation Package:

mvn deploy step:deploy-automation-package "-Dstep.url=https://your.step.server/" "-Dstep.step-project-name=Common" "-Dstep.auth-token=your_token_in_text_format"

Uploading Keywords to Step (deprecated)

This Maven goal deploys a packaged jar containing Step keywords to the configured Step server as a Keyword Package. The plugin determines if the same Keyword Package has already been uploaded to Step earlier and updates it if found, otherwise it creates a new Keyword Package in Step.

Notes:

Keywords packages are deprecated and will be replaced by Automation Packages.

To identify existing packages, the plugin uses a dedicated attribute called “tracking”. By default, it is a concatenation of the groupId and artifactId of the maven artifact, which fits most requirements. However, you can change this behaviour via plugin configuration.

Remember that the uploaded artefact must contain all required dependencies at runtime, in most cases we recommend to package a fat JAR (also called uber JAR) and reference it with the corresponding classifier.

Alternatively, you can pack all required external dependencies into a separate library file (jar) and attach it as library file to the keyword package. You have several ways to use this approach:

  • upload the library file manually to Step as a resource and reference it in your maven plugin configuration with a resource identifier (see the libStepResourceSearchCriteria configuration parameter)
  • deploy the library file to a maven-repository and reference it in your maven plugin configuration with maven coordinate (see the libArtifactGroupId, libArtifactId, libArtifactVersion and libArtifactClassifier parameters in maven plugin config).

You need to use the upload-keywords-package goal of the step-maven-plugin.

This goal has the following configuration

Property (xml) Command Line Alias Description Required Default Value
url step.url The URL of a running Step server true
stepProjectName step.step-project-name The name of the target project in Step (Enterprise only) false
authToken step.auth-token The authentication token issued by the Step server (Enterprise only) false
customPackageAttributes step-upload-keywords.custom-package-attrs Custom attributes passed to uploaded package to Step false
trackingAttribute step-upload-keywords.tracking-attr The ’tracking’ string used to identify the uniqueness of the uploaded package (if a package with the same tracking attribute already exists in step, this package will be updated) false ${project.groupId}.${project.artifactId}
artifactClassifier step-upload-keywords.artifact-classifier The classifier of the maven artifact (jar, jar-with-dependencies, tests etc) false no classifier
libStepResourceSearchCriteria step-upload-keywords.lib-step-resource-search-criteria The attributes of Step resource, which should be used as keyword package library file. You can define the following criteria (nested properties) to specify the target resource: id, name, projectId false
libArtifactGroupId step-upload-keywords.lib-artifact-group-id The group id of the keyword package library file (jar file, previously uploaded to the maven repository) false
libArtifactId step-upload-keywords.lib-artifact-id The artifact id of the keyword package library file (jar file, previously uploaded to the maven repository) false
libArtifactVersion step-upload-keywords.lib-artifact-version The artifact version of keyword package library file (jar file, previously uploaded to the maven repository) false
libArtifactClassifier step-upload-keywords.lib-artifact-classifier The artifact classifier of keyword package library file (jar file, previously uploaded to the maven repository) false no classifier

Example:

<plugin>
    <groupId>ch.exense.step</groupId>
    <artifactId>step-maven-plugin</artifactId>
    <executions>
        <execution>
            <id>upload-package-to-step</id>
            <phase>package</phase>
            <configuration>
                <url>http://localhost:4201</url>
                <!-- For EE, configure the target project and authentication key -->
                <!--<stepProjectName>Common</stepProjectName>
                <authToken>eyJhbGciOiJIUzI1NiJ9.eyJqdGkiOiJhMjUyYzhhNi1kO...</authToken>-->
              
                <!-- Example of library file configuration -->
                <!--
                  <libStepResourceSearchCriteria>
                    <id>64d933c88d944d61db7725e0</id>
                  </libStepResourceSearchCriteria> 
                -->
            </configuration>
            <goals>
                <goal>upload-keywords-package</goal>
            </goals>
        </execution>
    </executions>
</plugin>

You can use the following command to execute the plugin goal from the module containing package artifact with step keywords:

mvn package step:upload-keywords-package "-Dstep.url=https://your.step.server/"

See Also

  • Automation Package descriptor
  • Automation Packages
  • Getting started
  • Controls
  • Event Broker API
  • Home
  • Whats new?
  • Admin guide
  • SaaS guide
  • User guide
  • Developer guide
  • DevOps
    • Automation Packages
    • Automation Package descriptor
    • Maven plugin
    • Getting started
  • Plugins
  • Libraries
Step Logo
    • Documentation
    • Tutorials
    • Case studies
    • Blogs
    • Product
    • Home
    • Whats new?
    • Admin guide
    • SaaS guide
    • User guide
    • Developer guide
    • DevOps
      • Automation Packages
      • Automation Package descriptor
      • Maven plugin
      • Getting started
    • Plugins
    • Libraries