diff --git a/.gitpod/Dockerfile b/.gitpod/Dockerfile
index 28f5ac5af..13a3db3fc 100644
--- a/.gitpod/Dockerfile
+++ b/.gitpod/Dockerfile
@@ -2,8 +2,8 @@
# specifically tailored for building Jenkins plugins. It includes the installation of Maven,
# cloning of two specific Jenkins plugin repositories, and building these plugins using Maven.
-# Start from a base image that includes JDK 17 and Git. This serves as the foundation for the development environment.
-FROM gitpod/workspace-java-17
+# Start from a base image that includes JDK 21 and Git. This serves as the foundation for the development environment.
+FROM gitpod/workspace-java-21
# Define the versions of the JDKs to install. This is used by the `sdk install java` command to install the specified JDK.
ENV JDK8_PACKAGE=8.0.462-tem
diff --git a/Jenkinsfile b/Jenkinsfile
index 4fbd6ff82..438a9b51a 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -5,5 +5,5 @@ buildPlugin(
useContainerAgent: false,
configurations: [
[platform: 'linux', jdk: 21],
- [platform: 'windows', jdk: 17],
+ [platform: 'windows', jdk: 21],
])
diff --git a/README.md b/README.md
index 1da17d516..b6493a829 100644
--- a/README.md
+++ b/README.md
@@ -56,7 +56,7 @@ Learn more at [this project page](https://www.jenkins.io/projects/gsoc/2024/proj
### Requirements
- Maven version 3.9.7 or later, or mvnd
-- Java 17 or Java 21 ([Eclipse Temurin](https://adoptium.net/temurin/releases) recommended)
+- Java 21 ([Eclipse Temurin](https://adoptium.net/temurin/releases) recommended)
### Build
diff --git a/plugin-modernizer-cli/src/test/java/io/jenkins/tools/pluginmodernizer/cli/CommandLineITCase.java b/plugin-modernizer-cli/src/test/java/io/jenkins/tools/pluginmodernizer/cli/CommandLineITCase.java
index 22fe43bd8..b46e437ff 100644
--- a/plugin-modernizer-cli/src/test/java/io/jenkins/tools/pluginmodernizer/cli/CommandLineITCase.java
+++ b/plugin-modernizer-cli/src/test/java/io/jenkins/tools/pluginmodernizer/cli/CommandLineITCase.java
@@ -680,6 +680,7 @@ private InvocationRequest buildRequest(String args, Path logFile) {
properties.put("set.changelist", "true");
}
properties.put("exec.executable", javaHome.resolve("bin/java").toString());
+ LOG.debug("Using java executable: {}", properties.get("exec.executable"));
properties.put("test.cliArgs", args);
request.setProperties(properties);
diff --git a/plugin-modernizer-core/pom.xml b/plugin-modernizer-core/pom.xml
index 716d66c33..5b41904c1 100644
--- a/plugin-modernizer-core/pom.xml
+++ b/plugin-modernizer-core/pom.xml
@@ -147,12 +147,6 @@
org.openrewrite.recipe
rewrite-migrate-java
-
-
- org.openrewrite
- rewrite-java-21
-
-
org.openrewrite.recipe
diff --git a/plugin-modernizer-core/src/main/java/io/jenkins/tools/pluginmodernizer/core/impl/PluginModernizer.java b/plugin-modernizer-core/src/main/java/io/jenkins/tools/pluginmodernizer/core/impl/PluginModernizer.java
index 2bd626cf0..9d81e1e37 100644
--- a/plugin-modernizer-core/src/main/java/io/jenkins/tools/pluginmodernizer/core/impl/PluginModernizer.java
+++ b/plugin-modernizer-core/src/main/java/io/jenkins/tools/pluginmodernizer/core/impl/PluginModernizer.java
@@ -159,6 +159,7 @@ public void start() {
LOG.debug("Plugin Health Score Url: {}", config.getPluginHealthScore());
LOG.debug("Installation Stats Url: {}", config.getPluginStatsInstallations());
LOG.debug("Cache Path: {}", config.getCachePath());
+ LOG.debug("Java Version: {}", getJavaVersion());
LOG.debug("Maven Home: {}", config.getMavenHome());
LOG.debug("Maven Local Repository: {}", config.getMavenLocalRepo());
LOG.debug("Dry Run: {}", config.isDryRun());
@@ -237,7 +238,7 @@ private void process(Plugin plugin) {
plugin.checkoutBranch(ghService);
// Minimum JDK to run openrewrite
- plugin.withJDK(JDK.JAVA_17);
+ plugin.withJDK(JDK.JAVA_21);
// Collect metadata and move metadata from the target directory of the plugin to the common cache
if (!plugin.hasMetadata() || config.isFetchMetadataOnly()) {
@@ -348,7 +349,7 @@ private void process(Plugin plugin) {
// Recollect metadata after modernization
if (!config.isFetchMetadataOnly()) {
- plugin.withJDK(JDK.JAVA_17);
+ plugin.withJDK(JDK.JAVA_21);
plugin.clean(mavenInvoker);
collectMetadata(plugin, false);
LOG.debug(
@@ -416,7 +417,7 @@ private void process(Plugin plugin) {
*/
private void collectMetadata(Plugin plugin, boolean retryAfterFirstCompile) {
LOG.trace("Collecting metadata for plugin {}... Please be patient", plugin.getName());
- plugin.withJDK(JDK.JAVA_17);
+ plugin.withJDK(JDK.JAVA_21);
try {
plugin.collectMetadata(mavenInvoker);
if (plugin.hasErrors()) {
@@ -435,7 +436,7 @@ private void collectMetadata(Plugin plugin, boolean retryAfterFirstCompile) {
plugin.getName());
plugin.raiseLastError();
}
- plugin.withJDK(JDK.JAVA_17);
+ plugin.withJDK(JDK.JAVA_21);
plugin.collectMetadata(mavenInvoker);
} else {
LOG.info("Failed to collect metadata for plugin {}. Not retrying.", plugin.getName());
@@ -539,7 +540,7 @@ private JDK verifyPlugin(Plugin plugin) {
// Determine the JDK
JDK jdk;
if (metadata.getJdks() == null || metadata.getJdks().isEmpty()) {
- jdk = JDK.JAVA_17;
+ jdk = JDK.JAVA_21;
LOG.info(
"No JDKs found in metadata for plugin {}. Using same JDK as rewrite for verification",
plugin.getName());
diff --git a/plugin-modernizer-core/src/main/java/io/jenkins/tools/pluginmodernizer/core/model/Plugin.java b/plugin-modernizer-core/src/main/java/io/jenkins/tools/pluginmodernizer/core/model/Plugin.java
index d9155c8e1..a1743b2cf 100644
--- a/plugin-modernizer-core/src/main/java/io/jenkins/tools/pluginmodernizer/core/model/Plugin.java
+++ b/plugin-modernizer-core/src/main/java/io/jenkins/tools/pluginmodernizer/core/model/Plugin.java
@@ -788,7 +788,7 @@ public void collectMetadata(MavenInvoker maven) {
* @param maven The maven invoker instance
*/
public void runOpenRewrite(MavenInvoker maven) {
- withJDK(JDK.JAVA_17);
+ withJDK(JDK.JAVA_21);
if (config.isFetchMetadataOnly()) {
LOG.info("Skipping OpenRewrite recipe application for plugin {} as only metadata is required", name);
return;
diff --git a/pom.xml b/pom.xml
index 13f4df84a..c9a59d831 100644
--- a/pom.xml
+++ b/pom.xml
@@ -36,6 +36,7 @@
2024-01-01T00:00:00Z
+ 21
21
21
UTF-8
@@ -391,8 +392,8 @@
- 17,21
- Project requires Java 17 or Java 21
+ 21
+ Project Java 21