From f27e198615365c14334f724b9678e7a913114b61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonathan=20Schn=C3=A9ider?= Date: Tue, 20 Feb 2024 06:43:55 -0500 Subject: [PATCH] `org.openrewrite.gradle.Assertions#withToolingModel` moved to `org.openrewrite.gradle.toolingapi.Assertions` (#494) * `org.openrewrite.gradle.Assertions#withToolingModel` moved to `org.openrewrite.gradle.toolingapi.Assertions` Use this link to re-run the recipe: https://app.moderne.io/recipes/org.openrewrite.java.ChangeMethodTargetToStatic?organizationId=T3BlblJld3JpdGU%3D Co-authored-by: Moderne * Add org.openrewrite.gradle.tooling:model * Fix unrelated FindDependency reference --------- Co-authored-by: Moderne Co-authored-by: Knut Wannheden --- build.gradle.kts | 2 ++ .../java/spring/boot3/DowngradeServletApiWhenUsingJetty.java | 2 +- .../java/spring/boot2/UpdateMysqlDriverArtifactIdTest.java | 2 +- .../java/org/openrewrite/gradle/spring/UpdateGradleTest.java | 2 +- 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index d9bde17bb..efbb33b2d 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -136,6 +136,8 @@ dependencies { testImplementation("com.github.marschall:memoryfilesystem:latest.release") + testImplementation("org.openrewrite.gradle.tooling:model:$rewriteVersion") + // for generating properties migration configurations testImplementation("io.github.classgraph:classgraph:latest.release") testImplementation("org.openrewrite:rewrite-java-17") diff --git a/src/main/java/org/openrewrite/java/spring/boot3/DowngradeServletApiWhenUsingJetty.java b/src/main/java/org/openrewrite/java/spring/boot3/DowngradeServletApiWhenUsingJetty.java index 555e96f10..2a6d297cb 100644 --- a/src/main/java/org/openrewrite/java/spring/boot3/DowngradeServletApiWhenUsingJetty.java +++ b/src/main/java/org/openrewrite/java/spring/boot3/DowngradeServletApiWhenUsingJetty.java @@ -47,7 +47,7 @@ public Set getTags() { @Override public TreeVisitor getVisitor() { - return Preconditions.check(new FindDependency("org.springframework.boot", "spring-boot-starter-jetty"), new MavenVisitor() { + return Preconditions.check(new FindDependency("org.springframework.boot", "spring-boot-starter-jetty", null, null), new MavenVisitor() { @Override public @Nullable Xml visit(@Nullable Tree tree, ExecutionContext ctx) { if (tree == null) { diff --git a/src/testWithSpringBoot_2_5/java/org/openrewrite/java/spring/boot2/UpdateMysqlDriverArtifactIdTest.java b/src/testWithSpringBoot_2_5/java/org/openrewrite/java/spring/boot2/UpdateMysqlDriverArtifactIdTest.java index 2700b5b6f..757598adb 100644 --- a/src/testWithSpringBoot_2_5/java/org/openrewrite/java/spring/boot2/UpdateMysqlDriverArtifactIdTest.java +++ b/src/testWithSpringBoot_2_5/java/org/openrewrite/java/spring/boot2/UpdateMysqlDriverArtifactIdTest.java @@ -28,7 +28,7 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.openrewrite.gradle.Assertions.buildGradle; -import static org.openrewrite.gradle.Assertions.withToolingApi; +import static org.openrewrite.gradle.toolingapi.Assertions.withToolingApi; import static org.openrewrite.maven.Assertions.pomXml; @Issue("https://github.com/openrewrite/rewrite-spring/issues/274") diff --git a/src/testWithSpringBoot_2_7/java/org/openrewrite/gradle/spring/UpdateGradleTest.java b/src/testWithSpringBoot_2_7/java/org/openrewrite/gradle/spring/UpdateGradleTest.java index 89af8e98a..65177bc72 100644 --- a/src/testWithSpringBoot_2_7/java/org/openrewrite/gradle/spring/UpdateGradleTest.java +++ b/src/testWithSpringBoot_2_7/java/org/openrewrite/gradle/spring/UpdateGradleTest.java @@ -27,7 +27,7 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.openrewrite.gradle.Assertions.buildGradle; -import static org.openrewrite.gradle.Assertions.withToolingApi; +import static org.openrewrite.gradle.toolingapi.Assertions.withToolingApi; import static org.openrewrite.properties.Assertions.properties; import static org.openrewrite.test.SourceSpecs.other; import static org.openrewrite.test.SourceSpecs.text;