Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Assess and upgrade Azure workloads between plans, tiers, or SKUs with automated migration steps
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
references/languages/java/bom-migration/bom-gradle-toml.md
1# BOM Migration — Gradle TOML Version Catalog (`libs.versions.toml`)23OpenRewrite does not yet support TOML version catalogs ([openrewrite/rewrite#4400](https://github.com/openrewrite/rewrite/issues/4400)). Handle manually.45Check for `gradle/libs.versions.toml`. If it exists and contains Azure entries, apply these steps. Always update `build.gradle` / `build.gradle.kts` references in tandem.67> 💡 **Tip:** TOML alias `azure-sdk-bom` becomes accessor `libs.azure.sdk.bom` (hyphens→dots). CamelCase `azureSdkBom` becomes `libs.azureSdkBom`. Match the project's existing convention.89## Step 1 — Add or upgrade the BOM1011In `gradle/libs.versions.toml`:12```toml13[versions]14azureSdkBom = "{bom_version}"1516[libraries]17azure-sdk-bom = { group = "com.azure", name = "azure-sdk-bom", version.ref = "azureSdkBom" }18```1920In `build.gradle` (Groovy DSL):21```groovy22implementation enforcedPlatform(libs.azure.sdk.bom)23```2425In `build.gradle.kts` (Kotlin DSL):26```kotlin27implementation(enforcedPlatform(libs.azure.sdk.bom))28```2930## Step 2 — Remove explicit versions from BOM-managed libraries3132For each `com.azure.*` library in `[libraries]` that the BOM manages, drop `version.ref` / `version` and remove orphaned `[versions]` entries.3334```toml35# Before36[versions]37azureIdentity = "1.15.0"38[libraries]39azureIdentity = { group = "com.azure", name = "azure-identity", version.ref = "azureIdentity" }4041# After42[libraries]43azureIdentity = { group = "com.azure", name = "azure-identity" }44```4546## Step 3 — Replace legacy entries with modern equivalents4748For each `com.microsoft.azure.*` library: replace `group`/`name` with the modern `com.azure.*` equivalent, drop `version.ref`/`version` if BOM-managed, remove orphaned `[versions]` entries, and update alias references in `build.gradle` and `[bundles]`.4950```toml51# Before52[versions]53azureSdk = "1.41.4"54azureStorage = "8.6.6"55[libraries]56azure = { group = "com.microsoft.azure", name = "azure", version.ref = "azureSdk" }57azureStorage = { group = "com.microsoft.azure", name = "azure-storage", version.ref = "azureStorage" }5859# After (BOM-managed)60[libraries]61azureResourcemanager = { group = "com.azure.resourcemanager", name = "azure-resourcemanager" }62azureStorageBlob = { group = "com.azure", name = "azure-storage-blob" }63```6465Update `build.gradle` and `[bundles]` to use the new aliases.6667## TOML patterns to recognise6869Libraries may use any of these forms — handle all of them:70```toml71lib = { group = "g", name = "a", version.ref = "v" }72lib = { module = "g:a", version.ref = "v" }73lib = { module = "g:a", version = "1.0" }74lib = { group = "g", name = "a", version = { strictly = "1.0" } }75```76