The [Google Ads API Bill of Materials (BOM)](https://central.sonatype.com/artifact/com.google.api-ads/google-ads-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

Add the BOM to `<dependencyManagement>` and declare `google-ads` in your
`pom.xml` file:

    <!-- 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>48.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

Gradle 5.0 and later support importing a BOM natively using `platform()`.

In Groovy DSL (`build.gradle`):

    // Import the Bill of Materials (BOM).
    implementation platform('com.google.api-ads:google-ads-bom:48.1.0')

    // Add the google-ads dependency, without a version.
    implementation 'com.google.api-ads:google-ads'

In Kotlin DSL (`build.gradle.kts`):

    // Import the Bill of Materials (BOM).
    implementation(platform("com.google.api-ads:google-ads-bom:48.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](https://central.sonatype.com/artifact/com.google.api-ads/google-ads-bom) includes version management for several
common libraries, such as `Guava`, `Protobuf`, `GAX`, and `gRPC`. To avoid
potential dependency conflicts, you **must not** specify 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>

In Gradle Groovy DSL (`build.gradle`):

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

In Gradle Kotlin DSL (`build.gradle.kts`):

    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.

> [!TIP]
> **Tip:** If you still encounter `NoSuchMethodError` or `ClassNotFoundException`, run `mvn dependency:tree` (for Maven) or `./gradlew dependencies` (for Gradle) to identify which non-BOM plugin or dependency is forcing an incompatible transitive version.