Google Ads API বিল অফ মেটেরিয়াল (BOM) ডিপেন্ডেন্সি ভার্সন ম্যানেজ করে যাতে Guava ও GAX-এর মতো লাইব্রেরির সাথে ডিপেন্ডেন্সি সংক্রান্ত বিরোধ এড়ানো যায়।
এইসব লাইব্রেরি অন্যান্য ফ্রেমওয়ার্কও ব্যবহার করে। BOM নিশ্চিত করে যে আপনি এই ডিপেন্ডেন্সির সঠিক
ভার্সন ব্যবহার করছেন যা Google Ads ক্লায়েন্ট
লাইব্রেরির সাথে পরীক্ষা করা হয়েছে।
ক্লায়েন্ট লাইব্রেরি আর্টিফ্যাক্ট ব্যবহার করার জন্য এটিই হল সাজেস্ট করা পদ্ধতি।
Maven কনফিগারেশন
BOM-কে <dependencyManagement>-এ যোগ করুন এবং আপনার
pom.xml ফাইলে google-ads ঘোষণা করুন:
<!-- 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 কনফিগারেশন
Gradle 5.0 এবং তার পরবর্তী ভার্সন platform() ব্যবহার করে নেটিভভাবে BOM ইমপোর্ট করার সুবিধা দেয়।
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'
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")
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 Groovy DSL (build.gradle)-এ:
implementation 'com.google.guava:guava' // NO VERSION SPECIFIED
Gradle Kotlin DSL (build.gradle.kts)-এ:
implementation("com.google.guava:guava") // NO VERSION SPECIFIED
ভার্সন বাদ দিয়ে, আপনি BOM-কে এটি ম্যানেজ করতে দেন, যা বেমানান ডিপেন্ডেন্সি ভার্সনের কারণে হওয়া সমস্যা প্রতিরোধ করতে সাহায্য করে। ডিপেন্ডেন্সি কনফ্লিক্টের সাধারণ ইন্ডিকেটরের মধ্যে
NoSuchMethodError বা ClassNotFoundException অন্তর্ভুক্ত, যা প্রায়ই
BOM-ম্যানেজ করা সব ডিপেন্ডেন্সির কোনও ভার্সন নির্দিষ্ট করা নেই তা নিশ্চিত করার মাধ্যমে
সমাধান করা যেতে পারে।