diff --git a/src/main/resources/META-INF/rewrite/jacoco.yml b/src/main/resources/META-INF/rewrite/jacoco.yml index e10146c33c..6fd953db1c 100644 --- a/src/main/resources/META-INF/rewrite/jacoco.yml +++ b/src/main/resources/META-INF/rewrite/jacoco.yml @@ -19,14 +19,17 @@ name: 'JaCoCo' packageName: org.openrewrite.java.migrate.jacoco --- type: specs.openrewrite.org/v1beta/recipe -name: org.openrewrite.java.migrate.jacoco.UpgradeJaCoCoMavenPluginVersion -displayName: Upgrade JaCoCo Maven plugin version -description: This recipe will upgrade the JaCoCo Maven plugin to a more recent version compatible with Java 11. +name: org.openrewrite.java.migrate.jacoco.UpgradeJaCoCo +displayName: Upgrade JaCoCo +description: This recipe will upgrade JaCoCo to the latest patch version, which traditionally advertises full backwards compatibility for older Java versions. tags: - - java11 - jacoco recipeList: + - org.openrewrite.java.dependencies.UpgradeDependencyVersion: + groupId: org.jacoco + artifactId: "*" + newVersion: 0.8.x - org.openrewrite.maven.UpgradePluginVersion: groupId: org.jacoco artifactId: jacoco-maven-plugin - newVersion: 0.8.8 + newVersion: 0.8.x diff --git a/src/main/resources/META-INF/rewrite/java-version-11.yml b/src/main/resources/META-INF/rewrite/java-version-11.yml index 7c9347f41e..8147eacec1 100644 --- a/src/main/resources/META-INF/rewrite/java-version-11.yml +++ b/src/main/resources/META-INF/rewrite/java-version-11.yml @@ -56,7 +56,6 @@ recipeList: - org.openrewrite.java.migrate.javax.JavaxXmlStreamAPIs - org.openrewrite.java.migrate.cobertura.RemoveCoberturaMavenPlugin - org.openrewrite.java.migrate.wro4j.UpgradeWro4jMavenPluginVersion - - org.openrewrite.java.migrate.jacoco.UpgradeJaCoCoMavenPluginVersion - org.openrewrite.java.migrate.UpgradeJavaVersion: version: 11 - org.openrewrite.maven.UpgradePluginVersion: diff --git a/src/main/resources/META-INF/rewrite/java-version-21.yml b/src/main/resources/META-INF/rewrite/java-version-21.yml index 309c481658..778444b17d 100644 --- a/src/main/resources/META-INF/rewrite/java-version-21.yml +++ b/src/main/resources/META-INF/rewrite/java-version-21.yml @@ -38,10 +38,6 @@ recipeList: - org.openrewrite.gradle.UpdateGradleWrapper: version: 8.5 addIfMissing: false - - org.openrewrite.maven.UpgradePluginVersion: - groupId: org.jacoco - artifactId: jacoco-maven-plugin - newVersion: 0.8.+ - org.openrewrite.maven.UpgradePluginVersion: groupId: com.sonatype.clm artifactId: clm-maven-plugin diff --git a/src/main/resources/META-INF/rewrite/java-version-6.yml b/src/main/resources/META-INF/rewrite/java-version-6.yml index 8f5c6f34bf..370a715af9 100644 --- a/src/main/resources/META-INF/rewrite/java-version-6.yml +++ b/src/main/resources/META-INF/rewrite/java-version-6.yml @@ -30,6 +30,7 @@ name: org.openrewrite.java.migrate.JREWrapperInterface displayName: Add missing `isWrapperFor` and `unwrap` methods. description: Add method implementations stubs to classes that implement `java.sql.Wrapper`. recipeList: + - org.openrewrite.java.migrate.jacoco.UpgradeJaCoCo - org.openrewrite.java.migrate.AddMissingMethodImplementation: fullyQualifiedClassName: java.sql.Wrapper methodPattern: "*..* isWrapperFor(..)" diff --git a/src/test/java/org/openrewrite/java/migrate/UpgradeToJava6Test.java b/src/test/java/org/openrewrite/java/migrate/UpgradeToJava6Test.java index 00237e39ce..c9a67a7729 100644 --- a/src/test/java/org/openrewrite/java/migrate/UpgradeToJava6Test.java +++ b/src/test/java/org/openrewrite/java/migrate/UpgradeToJava6Test.java @@ -27,7 +27,7 @@ class UpgradeToJava6Test implements RewriteTest { @Override public void defaults(RecipeSpec spec) { - spec.recipeFromResource("/META-INF/rewrite/java-version-6.yml", "org.openrewrite.java.migrate.UpgradeToJava6") + spec.recipeFromResources("org.openrewrite.java.migrate.UpgradeToJava6") .allSources(src -> src.markers(javaVersion(6))); } diff --git a/src/test/java/org/openrewrite/java/migrate/jacoco/UpgradeJaCoCoMavenPluginVersionTest.java b/src/test/java/org/openrewrite/java/migrate/jacoco/UpgradeJaCoCoMavenPluginVersionTest.java deleted file mode 100644 index 28813bd98a..0000000000 --- a/src/test/java/org/openrewrite/java/migrate/jacoco/UpgradeJaCoCoMavenPluginVersionTest.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright 2022 the original author or authors. - *
- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *
- * https://www.apache.org/licenses/LICENSE-2.0 - *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.openrewrite.java.migrate.jacoco;
-
-import org.junit.jupiter.api.Test;
-import org.openrewrite.DocumentExample;
-import org.openrewrite.config.Environment;
-import org.openrewrite.test.RecipeSpec;
-import org.openrewrite.test.RewriteTest;
-
-import static org.openrewrite.maven.Assertions.pomXml;
-
-
-class UpgradeJaCoCoMavenPluginVersionTest implements RewriteTest {
- @Override
- public void defaults(RecipeSpec spec) {
- spec.recipe(Environment.builder()
- .scanRuntimeClasspath("org.openrewrite.java.migrate.jacoco")
- .build()
- .activateRecipes("org.openrewrite.java.migrate.jacoco.UpgradeJaCoCoMavenPluginVersion"));
- }
-
- @DocumentExample
- @Test
- void property() {
- rewriteRun(
- //language=xml
- pomXml(
- """
-
+ * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + *
+ * https://www.apache.org/licenses/LICENSE-2.0 + *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.openrewrite.java.migrate.jacoco;
+
+import org.junit.jupiter.api.Test;
+import org.openrewrite.DocumentExample;
+import org.openrewrite.test.RecipeSpec;
+import org.openrewrite.test.RewriteTest;
+
+import java.util.regex.Pattern;
+
+import static org.openrewrite.maven.Assertions.pomXml;
+
+class UpgradeJaCoCoTest implements RewriteTest {
+ private static final Pattern JACOCO_VERSION_PATTERN = Pattern.compile("