Maven/Gradle jar dependencies

2 minute read

This section contains how to build a jar file with Groovy sources that have CloudBees CD/RO classes as dependencies. For example:

  • import com.electriccloud.client.groovy.ElectricFlow

  • import com.electriccloud.client.groovy.models.ActualParameter

To achieve this, users need the commander-api-bindings.jar available on a Maven repository if it is not wanted as a local resource on a project. Currently, users build the jar on the local development environment.

Verify if the .jar dependency is available in the Maven repository

Prior to creating the jar dependency, verify if the jar is available in the Maven repository. The following maven.package cannot be accessed via the browser, use the curl command for verification.

  1. Verify if the jar is available in the Maven repository by running the following command:

  2. If the command is successful, the jar is available in the Maven repository.

Create a .jar dependency

By publishing the API bindings for the ElectricFlow Jave/Groovy library to Maven Central or equivalent, users can now use Maven/Gradle to add the dependency directly without having to upload to their Maven servers.

  • Jar to be published to Maven Central or equivalent repository.

    commander-api-bindings.jar

Follow the steps below to use the dependency:

  1. Create a POM file with the following content:

    Maven
    Gradle
    <dependency> <groupId>com.electriccloud</groupId> <artifactId>commander-api-bindings</artifactId> <version>2025.06.0</version> </dependency>
    compile group: 'com.electriccloud', name: 'commander-api-bindings', version: '2025.06.0'
  2. Add a repository tag:

    <repositories>
       <!-- Required for retrieving commander-api-bidings from the CloudBees repository -->
       <repository>
         <id>cloudbees-public-repo</id>
         <url>https://us-east1-maven.pkg.dev/flow-testing-project/cloudbees-cdro-maven-public-releases</url>
       </repository>
     </repositories>

If unable to fetch the commander-api-bindings.jar after adding the required dependency and repository tags, the settings.xml file needs to be updated as follows:

  • Add !cloudbees-public-repo to the mirror0f attribute in the <mirror> configuration.

This configuration fetches the commander-api-bindings.jar from the specified repository URL, instead of attempting to retrieve it from the default Maven repository.