diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index bdabffae3b..aca33584ec 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -57,5 +57,5 @@ jobs:
cache: 'maven'
- name: Build with Maven
- run: mvn -B clean install -Dno-format
+ run: mvn --batch-mode --no-transfer-progress clean install -Dno-format -Dstyle.color=always
diff --git a/pom.xml b/pom.xml
index 40cafc3b3b..beac519082 100644
--- a/pom.xml
+++ b/pom.xml
@@ -61,11 +61,11 @@
- 2.23.1
+ 3.0.2
- 5.47.0
+ 6.0.4
- 6.29.0
+ 7.0.3
4.8.0
@@ -75,7 +75,7 @@
4.5.14
- 1.18.34
+ 1.18.36
1.7.36
3.2.5
diff --git a/recipes/pom.xml b/recipes/pom.xml
index 689d5cf947..7cc1cffb72 100644
--- a/recipes/pom.xml
+++ b/recipes/pom.xml
@@ -59,6 +59,11 @@
rewrite-java-17
provided
+
+ org.openrewrite
+ rewrite-java-21
+ provided
+
io.micrometer
micrometer-core
@@ -66,11 +71,20 @@
org.openrewrite.recipe
- rewrite-migrate-java
+ rewrite-quarkus
+
+
+ org.openrewrite.recipe
+ rewrite-migrate-java
+
+
+
+
- org.openrewrite.recipe
- rewrite-quarkus
+ org.openrewrite
+ rewrite-gradle
+ provided
@@ -139,6 +153,12 @@
org.apache.camel.upgrade
camel-upgrade-recipes
${camel-upgrade-recipes.version}
+
+
+ org.openrewrite.recipe
+ rewrite-migrate-java
+
+
diff --git a/recipes/src/main/java/io/quarkus/updates/core/quarkus37/SetupJavaUpgradeJavaVersion.java b/recipes/src/main/java/io/quarkus/updates/core/quarkus37/SetupJavaUpgradeJavaVersion.java
new file mode 100644
index 0000000000..b80e7dfce0
--- /dev/null
+++ b/recipes/src/main/java/io/quarkus/updates/core/quarkus37/SetupJavaUpgradeJavaVersion.java
@@ -0,0 +1,74 @@
+package io.quarkus.updates.core.quarkus37;
+
+import org.openrewrite.*;
+import org.openrewrite.yaml.JsonPathMatcher;
+import org.openrewrite.yaml.YamlVisitor;
+import org.openrewrite.yaml.tree.Yaml;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import lombok.EqualsAndHashCode;
+import lombok.Value;
+
+@Value
+@EqualsAndHashCode(callSuper = false)
+public class SetupJavaUpgradeJavaVersion extends Recipe {
+
+ @Option(displayName = "Java version",
+ description = "The Java version to upgrade to.",
+ example = "17")
+ Integer minimumJavaMajorVersion;
+
+ @Override
+ public String getDisplayName() {
+ return "Upgrade `actions/setup-java` `java-version`";
+ }
+
+ @Override
+ public String getDescription() {
+ return "Update the Java version used by `actions/setup-java` if it is below the expected version number.";
+ }
+
+ private static final JsonPathMatcher javaVersion = new JsonPathMatcher("..steps[?(@.uses =~ 'actions/setup-java@v*.*')].with.java-version");
+ private static final Pattern javaVersionPattern = Pattern.compile("([0-9]+)(\\.[0-9]+)*([-+].*)?");
+
+ @Override
+ public TreeVisitor, ExecutionContext> getVisitor() {
+ return Preconditions.check(
+ new FindSourceFiles(".github/workflows/*.yml"),
+ new YamlVisitor<>() {
+ @Override
+ public Yaml visitMappingEntry(Yaml.Mapping.Entry entry, ExecutionContext ctx) {
+ if (!javaVersion.matches(getCursor())) {
+ return super.visitMappingEntry(entry, ctx);
+ }
+
+ Yaml.Scalar currentValue = (Yaml.Scalar) entry.getValue();
+
+ // specific versions are allowed by `actions/setup-java`
+ Matcher matcher = javaVersionPattern.matcher(currentValue.getValue());
+ if (!matcher.matches()) {
+ return super.visitMappingEntry(entry, ctx);
+ }
+
+ int currentMajorVersion;
+ try {
+ currentMajorVersion = Integer.parseInt(matcher.group(1));
+ } catch (NumberFormatException ex) {
+ return super.visitMappingEntry(entry, ctx);
+ }
+
+ if (currentMajorVersion >= minimumJavaMajorVersion) {
+ return super.visitMappingEntry(entry, ctx);
+ }
+
+ return super.visitMappingEntry(
+ entry.withValue(currentValue.withValue(String.valueOf(minimumJavaMajorVersion))),
+ ctx
+ );
+ }
+ });
+ }
+
+}
\ No newline at end of file
diff --git a/recipes/src/main/java/io/quarkus/updates/core/quarkus37/UpgradeJavaVersion.java b/recipes/src/main/java/io/quarkus/updates/core/quarkus37/UpgradeJavaVersion.java
new file mode 100644
index 0000000000..233b3f2483
--- /dev/null
+++ b/recipes/src/main/java/io/quarkus/updates/core/quarkus37/UpgradeJavaVersion.java
@@ -0,0 +1,76 @@
+package io.quarkus.updates.core.quarkus37;
+
+import lombok.EqualsAndHashCode;
+import lombok.Value;
+import org.openrewrite.ExecutionContext;
+import org.openrewrite.Option;
+import org.openrewrite.Recipe;
+import org.openrewrite.TreeVisitor;
+import org.openrewrite.gradle.UpdateJavaCompatibility;
+import org.openrewrite.java.JavaIsoVisitor;
+import org.openrewrite.java.marker.JavaVersion;
+import org.openrewrite.maven.UpdateMavenProjectPropertyJavaVersion;
+import org.openrewrite.maven.UseMavenCompilerPluginReleaseConfiguration;
+import org.openrewrite.java.tree.J;
+
+import java.time.Duration;
+import java.util.*;
+
+@Value
+@EqualsAndHashCode(callSuper = false)
+public class UpgradeJavaVersion extends Recipe {
+
+ @Option(displayName = "Java version",
+ description = "The Java version to upgrade to.",
+ example = "17")
+ Integer version;
+
+ @Override
+ public String getDisplayName() {
+ return "Upgrade Java version";
+ }
+
+ @Override
+ public String getDescription() {
+ return "Upgrade build plugin configuration to use the specified Java version. " +
+ "This recipe changes `java.toolchain.languageVersion` in `build.gradle(.kts)` of gradle projects, " +
+ "or maven-compiler-plugin target version and related settings. " +
+ "Will not downgrade if the version is newer than the specified version.";
+ }
+
+ @Override
+ public List getRecipeList() {
+ return Arrays.asList(
+ new UseMavenCompilerPluginReleaseConfiguration(version),
+ new UpdateMavenProjectPropertyJavaVersion(version),
+ new UpdateJavaCompatibility(version, null, null, false, null)
+ );
+ }
+
+ /**
+ * This recipe only updates markers, so it does not correspond to human manual effort.
+ *
+ * @return Zero estimated time.
+ */
+ @Override
+ public Duration getEstimatedEffortPerOccurrence() {
+ return Duration.ofMinutes(0);
+ }
+
+ @Override
+ public TreeVisitor, ExecutionContext> getVisitor() {
+ String newVersion = version.toString();
+ Map updatedMarkers = new HashMap<>();
+ return new JavaIsoVisitor<>() {
+ @Override
+ public J preVisit(J tree, ExecutionContext ctx) {
+ Optional maybeJavaVersion = tree.getMarkers().findFirst(JavaVersion.class);
+ if (maybeJavaVersion.isPresent() && maybeJavaVersion.get().getMajorVersion() < version) {
+ return tree.withMarkers(tree.getMarkers().setByType(updatedMarkers.computeIfAbsent(maybeJavaVersion.get(),
+ m -> m.withSourceCompatibility(newVersion).withTargetCompatibility(newVersion))));
+ }
+ return tree;
+ }
+ };
+ }
+}
\ No newline at end of file
diff --git a/recipes/src/main/resources/quarkus-updates/core/3.7.alpha1.yaml b/recipes/src/main/resources/quarkus-updates/core/3.7.alpha1.yaml
index 0f63e663cd..d53e2da96a 100644
--- a/recipes/src/main/resources/quarkus-updates/core/3.7.alpha1.yaml
+++ b/recipes/src/main/resources/quarkus-updates/core/3.7.alpha1.yaml
@@ -137,7 +137,7 @@ description: >
tags:
- java17
recipeList:
- - org.openrewrite.github.SetupJavaUpgradeJavaVersion:
+ - io.quarkus.updates.core.quarkus37.SetupJavaUpgradeJavaVersion:
minimumJavaMajorVersion: 17
- org.openrewrite.java.RemoveMethodInvocations:
methodPattern: java.lang.Runtime traceInstructions(boolean)
@@ -150,15 +150,15 @@ recipeList:
---
type: specs.openrewrite.org/v1beta/recipe
name: io.quarkus.updates.core.quarkus37.JavaVersion17
-displayName: Change Maven Java version property values to 17
+displayName: Change Maven and Gradle Java version property values to 17
description: Change maven.compiler.source and maven.compiler.target values to 17.
tags:
- java17
- compiler
recipeList:
- - org.openrewrite.java.migrate.UpgradeJavaVersion:
+ - io.quarkus.updates.core.quarkus37.UpgradeJavaVersion:
version: 17
- - org.openrewrite.java.migrate.maven.UseMavenCompilerPluginReleaseConfiguration:
+ - org.openrewrite.maven.UseMavenCompilerPluginReleaseConfiguration:
releaseVersion: 17
---
type: specs.openrewrite.org/v1beta/recipe
@@ -179,7 +179,7 @@ description: The `com.sun.net.ssl.internal.ssl.Provider` provider name was remov
tags:
- java17
recipeList:
- - org.openrewrite.java.migrate.ReplaceStringLiteralValue:
+ - org.openrewrite.java.ReplaceStringLiteralValue:
oldLiteralValue: com.sun.net.ssl.internal.ssl.Provider
newLiteralValue: SunJSSE
---
@@ -193,7 +193,7 @@ recipeList:
- org.openrewrite.java.ChangeMethodName:
methodPattern: java.util.logging.LogRecord getThreadID()
newMethodName: getLongThreadID
- - org.openrewrite.java.migrate.ChangeMethodInvocationReturnType:
+ - org.openrewrite.java.ChangeMethodInvocationReturnType:
methodPattern: java.util.logging.LogRecord getLongThreadID()
newReturnType: long
- org.openrewrite.java.ChangeMethodName: