We are excited to announce the release of the google-ads-bom
for the Google Ads API client library for Java , now available with v40.0.0 of the google-ads
client library. This new Bill of Materials (BOM) is designed to significantly simplify your dependency management and enhance the stability of your Google Ads API integrations.
What is a BOM?
A BOM is a build-time tool that provides a centralized, authoritative "rulebook" for managing dependency versions. By importing our BOM, you ensure your project uses the exact set of compatible dependency versions that the Google Ads client was built and tested against. This significantly helps avoid dependency conflicts with libraries like Guava and GAX , which are also used by many other frameworks.
How to incorporate the google-ads-bom
into your code
To leverage the benefits of the google-ads-bom
, import it into the
section of your build file (e.g., pom.xml
for Maven or build.gradle
for Gradle). You should then omit the version specification from the google-ads
dependency in the
section.
How to include the BOM in your Maven project:
<!-- Import the Bill of Materials (BOM) -->
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.google.api-ads</groupId>
<artifactId>google-ads-bom</artifactId>
<version>40.0.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<!-- Add the google-ads dependency without a version -->
<dependencies>
<dependency>
<groupId>com.google.api-ads</groupId>
<artifactId>google-ads</artifactId>
</dependency>
</dependencies>
How to include the BOM in your Gradle project:
// Import the Bill of Materials (BOM).
implementation platform('com.google.api-ads:google-ads-bom:40.0.0')
// Add the google-ads dependency, without a version. The version is managed by the BOM.
implementation 'com.google.api-ads:google-ads'
Declaring dependencies covered by the google-ads-bom
The BOM automatically manages the versions for several common libraries–such as Guava , Protobuf , GAX , and gRPC –to make them compatible. To avoid potential dependency conflicts, you should not specify a version when declaring these dependencies. For example, if you are using Guava, you would declare it without a version:
In Maven:
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</dependency>
Or in Gradle:
implementation 'com.google.guava:guava' // NO VERSION SPECIFIED.
To retrieve a list of constrained dependencies that can be imported using the BOM without a declared version, use the listAllDependencyConstraints
gradle task.
To learn more about this new google-ads-bom
offering and how to configure your Java client, check out our getting started guide .
- Sarah Pollack, Google Ads API Team