Bill of Materials

The Google Ads API Bill of Materials (BOM) manages dependency versions to avoid dependency conflicts with libraries like Guava and GAX that are also used by other frameworks. The BOM ensures that you use the exact versions of these dependencies that have been tested with the Google Ads client library.

This is the recommended way to consume the client library artifacts.

Maven configuration {#maven-configuration}

The Maven dependency is:

 <!--  
Import  
the  
Bill  
of  
Materials  
(BOM)  
to  
ensure  
you're  
using  
compatible  
versions  
of  
all  
google-ads  
libraries.  
-->
<dependencyManagement>  
<dependencies>  
<dependency>  
<groupId>com.google.api-ads</groupId>  
<artifactId>google-ads-bom</artifactId>  
<version>41.1.0</version>  
<type>pom</type>  
<scope>import</scope>  
</dependency>  
</dependencies>
</dependencyManagement>

<!--  
Add  
the  
google-ads  
dependency,  
without  
a  
version.  
The  
version  
is  
managed  
by  
the  
BOM.  
-->
<dependency>  
<groupId>com.google.api-ads</groupId>  
<artifactId>google-ads</artifactId>
</dependency> 

Gradle configuration

The Gradle dependency is:

 //  
Import  
the  
Bill  
of  
Materials  
 ( 
BOM ) 
.
implementation  
platform ( 
 'com.google.api-ads:google-ads-bom:41.1.0' 
 ) 
//  
Add  
the  
google-ads  
dependency,  
without  
a  
version.
implementation  
 'com.google.api-ads:google-ads' 
 

Declaring dependencies covered by the BOM

The Google Ads API BOM includes version management for several common libraries, such as Guava , Protobuf , GAX , and gRPC . To avoid potential dependency conflicts, you must notspecify a version when declaring dependencies that the BOM covers. The BOM automatically manages the versions for these libraries, ensuring compatibility.

For example, to declare the Guava dependency in Maven, use the following:

 <dependency>  
<groupId>com.google.guava</groupId>  
<artifactId>guava</artifactId>  
<!--  
NO  
VERSION  
SPECIFIED  
-->
</dependency> 

And in Gradle:

 implementation  
 'com.google.guava:guava' 
  
//  
NO  
VERSION  
SPECIFIED 

By omitting the version, you let the BOM manage it, which helps prevent issues caused by incompatible dependency versions. Common indicators of dependency conflicts include NoSuchMethodError or ClassNotFoundException , which can often be resolved by ensuring all BOM-managed dependencies have no version specified.

Design a Mobile Site
View Site in Mobile | Classic
Share by: