Announcing a faster release cadence for the Azure client SDK BOM for Java

Pallavi Taneja

In April 2020, the Azure SDK for Java team released its first Azure client SDK Bill of Materials (BOM). This BOM file includes all Generally Available (GA) Azure SDK for Java client packages with their compatible dependency version. Using the BOM file eases dependency version management for customers. However, customers also indicated the slower release cadence hindered its adoption.

Beginning in September of 2021, the Azure client SDK BOM has been released monthly. You can depend on the latest features of Azure SDK client libraries with BOM.

Include Azure SDK client library in your project using BOM

The Azure SDK for Java supports each Azure service through one or more Maven packages. To include the Java client library for an Azure service:

  1. Add the following snippet in your project’s pom.xml file:
    <dependencyManagement>
      <dependencies>
        <dependency>
          <groupId>com.azure</groupId>
          <artifactId>azure-sdk-bom</artifactId>
          <version>{bom_version_to_target}</version>
          <type>pom</type>
          <scope>import</scope>
        </dependency>
      </dependencies>
    </dependencyManagement>
    
    <dependencies>
      <dependency>
        <groupId>com.azure</groupId>
        <artifactId>{artifactId}</artifactId>
      </dependency>
      <dependency>
        <groupId>com.azure</groupId>
        <artifactId>{artifactId}</artifactId>
      </dependency>
    </dependencies>
  2. Replace the {bom_version_to_target} placeholder with the BOM version number to target.
  3. Replace {artifactId} with the Azure service’s client library package name.

All releases of the Azure SDK for Java client BOM can be found here. Including the BOM in your project ensures Maven picks the library versions specified in it for all Azure client SDKs in your project. To upgrade to a newer version of the Azure SDK for Java client libraries, update the azure-sdk-bom version, which is released monthly.

Why to use dependency versions in the BOM

Consider the following dependency section from a pom.xml file:

<dependencies>
  <dependency>
    <groupId>com.azure</groupId>
    <artifactId>azure-messaging-servicebus</artifactId>
    <version>7.4.2</version>
  </dependency>
  <dependency>
    <groupId>com.azure</groupId>
    <artifactId>azure-messaging-eventhubs</artifactId>
    <version>5.10.1</version>
  </dependency>
</dependencies>

These dependencies introduce multiple versions of azure-core and azure-core-amqp in the dependency tree. The multiple versions can cause unexpected issues for your app at compile time or runtime.

versionconflict

To ensure Maven retrieves the correct version of each of the dependencies, specify your dependencies as follows:

<dependencyManagement>
  <dependencies>
    <dependency>
      <groupId>com.azure</groupId>
      <artifactId>azure-sdk-bom</artifactId>
      <version>1.0.5</version>
      <type>pom</type>
      <scope>import</scope>
    </dependency>
  </dependencies>
</dependencyManagement>

Then include the direct dependency in the dependencies section without the version tag.

<dependencies>
  <dependency>
    <groupId>com.azure</groupId>
    <artifactId>azure-messaging-servicebus</artifactId>
  </dependency>
  <dependency>
    <groupId>com.azure</groupId>
    <artifactId>azure-messaging-eventhubs</artifactId>
  </dependency>
</dependencies>

The Maven version for each of these libraries will be resolved to the version specified in the BOM. The dependency resolution for this pom.xml file is as follows.

noversionconflict

dependencyresolution

As you can see, all Azure SDK Java packages are now resolved to a single version with no conflicts.

Azure SDK Blog Contributions

Thanks for reading this Azure SDK blog post. We hope you learned something new, and we welcome you to share the post. We’re open to Azure SDK blog contributions from our readers. To get started, contact us at azsdkblog@microsoft.com with your idea, and we’ll set you up as a guest blogger.

0 comments

Discussion is closed.

Feedback usabilla icon