Class MigrateKotlinDslBomImport

java.lang.Object
org.openrewrite.Recipe
org.axonframework.migration.MigrateKotlinDslBomImport
All Implemented Interfaces:
Cloneable

public class MigrateKotlinDslBomImport extends org.openrewrite.Recipe
Rewrites Kotlin DSL Spring Dependency Management mavenBom(...) imports whose version is supplied via Kotlin string-template indirection (typically ${property("axonFrameworkVersion")} read from an extra["axonFrameworkVersion"] declaration). Optionally updates the matching extra["..."] literal to the AF5-line version in the same pass.

Why not gradle.ChangeManagedDependency? The stock trait that backs that recipe ( SpringDependencyManagementPluginEntry.Matcher) only extracts a version variable from K.StringTemplate when the embedded expression is a bare J.Identifier. Method-invocation forms like property("name") / findProperty("name") are recognized for Groovy GStrings but not for Kotlin string templates, so the trait silently no-ops on the Cinema-style fixture


 extra["axonFrameworkVersion"] = "4.12.1"
 dependencyManagement {
     imports {
         mavenBom("org.axonframework:axon-bom:${property("axonFrameworkVersion")}")
     }
 }
 
This recipe fills that gap with a small, Kotlin-DSL-only visitor that matches the mavenBom(...) method-invocation node directly and rewrites the literal groupId:artifactId: prefix in the string-template's leading literal piece. The ${...} indirection is preserved verbatim.
Since:
5.1.1
Author:
Mateusz Nowak
  • Nested Class Summary

    Nested classes/interfaces inherited from class org.openrewrite.Recipe

    org.openrewrite.Recipe.Builder, org.openrewrite.Recipe.DelegatingRecipe
  • Field Summary

    Fields inherited from class org.openrewrite.Recipe

    contributors, examples, PANIC
  • Constructor Summary

    Constructors
    Constructor
    Description
    MigrateKotlinDslBomImport(String oldGroupId, String oldArtifactId, String newGroupId, String newArtifactId, @Nullable String extraPropertyKey, @Nullable String newVersion)
     
  • Method Summary

    Modifier and Type
    Method
    Description
     
     
    org.openrewrite.TreeVisitor<?,org.openrewrite.ExecutionContext>
     

    Methods inherited from class org.openrewrite.Recipe

    addDataTable, builder, buildRecipeList, causesAnotherCycle, clone, createRecipeDescriptor, equals, getContributors, getDataTableDescriptors, getDescriptor, getEstimatedEffortPerOccurrence, getExamples, getInstanceName, getInstanceNameSuffix, getJacksonPolymorphicTypeTag, getMaintainers, getName, getRecipeList, getTags, hashCode, maxCycles, noop, onComplete, run, run, run, setContributors, setExamples, validate, validate, validateAll, validateAll, withOptions

    Methods inherited from class java.lang.Object

    finalize, getClass, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • MigrateKotlinDslBomImport

      public MigrateKotlinDslBomImport(String oldGroupId, String oldArtifactId, String newGroupId, String newArtifactId, @Nullable String extraPropertyKey, @Nullable String newVersion)
  • Method Details

    • getDisplayName

      public String getDisplayName()
      Specified by:
      getDisplayName in class org.openrewrite.Recipe
    • getDescription

      public String getDescription()
      Specified by:
      getDescription in class org.openrewrite.Recipe
    • getVisitor

      public org.openrewrite.TreeVisitor<?,org.openrewrite.ExecutionContext> getVisitor()
      Overrides:
      getVisitor in class org.openrewrite.Recipe