Package org.axonframework.migration
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 -
Method Summary
Modifier and TypeMethodDescriptionorg.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
-
Constructor Details
-
MigrateKotlinDslBomImport
-
-
Method Details
-
getDisplayName
- Specified by:
getDisplayNamein classorg.openrewrite.Recipe
-
getDescription
- Specified by:
getDescriptionin classorg.openrewrite.Recipe
-
getVisitor
public org.openrewrite.TreeVisitor<?,org.openrewrite.ExecutionContext> getVisitor()- Overrides:
getVisitorin classorg.openrewrite.Recipe
-