재료명세서

Google Ads API BOM(Bill of Materials)은 다른 프레임워크에서도 사용되는 Guava, GAX와 같은 라이브러리와의 종속 항목 충돌을 방지하기 위해 종속 항목 버전을 관리합니다. BOM을 사용하면 Google Ads 클라이언트 라이브러리로 테스트된 정확한 버전의 종속 항목을 사용할 수 있습니다.

클라이언트 라이브러리 아티팩트를 사용하는 방법으로 권장됩니다.

Maven 구성 {#maven-configuration}

Maven 종속 항목은 다음과 같습니다.

<!-- 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 구성

Gradle 종속 항목은 다음과 같습니다.

// 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'

BOM으로 관리되는 종속 항목 선언

Google Ads API BOM에는 Guava, Protobuf, GAX, gRPC과 같은 여러 일반 라이브러리의 버전 관리가 포함됩니다. 잠재적인 종속 항목 충돌을 방지하려면 BOM에서 다루는 종속 항목을 선언할 때 버전을 지정하면 안 됩니다. BOM은 이러한 라이브러리의 버전을 자동으로 관리하여 호환성을 보장합니다.

예를 들어 Maven에서 Guava 종속 항목을 선언하려면 다음을 사용합니다.

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

Gradle의 경우:

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

버전을 생략하면 BOM에서 버전을 관리하므로 호환되지 않는 종속 항목 버전으로 인한 문제를 방지할 수 있습니다. 종속 항목 충돌의 일반적인 지표에는 NoSuchMethodError 또는 ClassNotFoundException이 포함되며, 이는 BOM 관리 종속 항목에 버전이 지정되지 않도록 하면 해결되는 경우가 많습니다.