diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml
index 75f0a243b2e1..cb0e5f264750 100644
--- a/.github/workflows/maven.yml
+++ b/.github/workflows/maven.yml
@@ -33,7 +33,7 @@ jobs:
- name: Set up JDK
uses: actions/setup-java@v4
with:
- java-version: 17
+ java-version: 21
distribution: 'temurin'
- name: Checkout maven
diff --git a/README.md b/README.md
index a96b11fb7745..211206935aca 100644
--- a/README.md
+++ b/README.md
@@ -66,7 +66,7 @@ Do you like Apache Maven? Then [donate back to the ASF](https://www.apache.org/f
Quick Build
-------
If you want to bootstrap Maven, you'll need:
-- Java 17+
+- Java 21+
- Maven 3.6.3 or later
- Run Maven, specifying a location into which the completed Maven distro should be installed:
```
diff --git a/apache-maven/src/assembly/maven/bin/mvn b/apache-maven/src/assembly/maven/bin/mvn
index 511e5e241fac..9b3498efdcb5 100755
--- a/apache-maven/src/assembly/maven/bin/mvn
+++ b/apache-maven/src/assembly/maven/bin/mvn
@@ -108,7 +108,7 @@ else
fi
if ! "$JAVACMD" --enable-native-access=ALL-UNNAMED -version >/dev/null 2>&1; then
- echo "Error: Apache Maven 4.x requires Java 17 or newer to run." >&2
+ echo "Error: Apache Maven 4.x requires Java 21 or newer to run." >&2
"$JAVACMD" -version >&2
echo "Please upgrade your Java installation or set JAVA_HOME to point to a compatible JDK." >&2
exit 1
diff --git a/apache-maven/src/assembly/maven/bin/mvn.cmd b/apache-maven/src/assembly/maven/bin/mvn.cmd
index 4d292203c130..899552df7e7f 100644
--- a/apache-maven/src/assembly/maven/bin/mvn.cmd
+++ b/apache-maven/src/assembly/maven/bin/mvn.cmd
@@ -70,10 +70,10 @@ if not exist "%JAVACMD%" (
goto error
)
-@REM Check Java version by testing the Java 17+ flag
+@REM Check Java version by testing the Java 21+ flag
"%JAVACMD%" --enable-native-access=ALL-UNNAMED -version >nul 2>&1
if ERRORLEVEL 1 (
- echo Error: Apache Maven 4.x requires Java 17 or newer to run. >&2
+ echo Error: Apache Maven 4.x requires Java 21 or newer to run. >&2
"%JAVACMD%" -version >&2
echo Please upgrade your Java installation or set JAVA_HOME to point to a compatible JDK. >&2
goto error
diff --git a/api/maven-api-model/src/main/mdo/maven.mdo b/api/maven-api-model/src/main/mdo/maven.mdo
index 0aff238fd24e..e4beedee27ca 100644
--- a/api/maven-api-model/src/main/mdo/maven.mdo
+++ b/api/maven-api-model/src/main/mdo/maven.mdo
@@ -2107,7 +2107,7 @@
If a target version, different from the base version, is specified for resources or script files,
then this value modifies the directory where the files will be copied.
- For example, if {@code targetVersion} is 17, then the {@code foo/bar.properties}
+ For example, if {@code targetVersion} is 21, then the {@code foo/bar.properties}
resource file will be copied as {@code META-INF/versions/17/foo/bar.properties}.
This element can be combined with the {@code module} element for specifying sources,
diff --git a/impl/maven-impl/src/test/resources/poms/factory/props-and-profiles-grand-parent.xml b/impl/maven-impl/src/test/resources/poms/factory/props-and-profiles-grand-parent.xml
index 26230696587a..ae10708f0bdc 100644
--- a/impl/maven-impl/src/test/resources/poms/factory/props-and-profiles-grand-parent.xml
+++ b/impl/maven-impl/src/test/resources/poms/factory/props-and-profiles-grand-parent.xml
@@ -27,7 +27,7 @@
true
- 17
+ 21
diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7737ProfileActivationTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7737ProfileActivationTest.java
index 251bcff7cf11..0dc6801e67fd 100644
--- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7737ProfileActivationTest.java
+++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7737ProfileActivationTest.java
@@ -53,7 +53,7 @@ void testSingleMojoNoPom() throws Exception {
verifier.execute();
verifier.verifyErrorFreeLog();
- // Example output on my Linux Box w/ Java 17
+ // Example output on my Linux Box w/ Java 21
// The following profiles are active:
//
// - settings-active-default (source: external)
@@ -61,6 +61,7 @@ void testSingleMojoNoPom() throws Exception {
// - settings-jdk-8 (source: external)
// - settings-jdk-11 (source: external)
// - settings-jdk-17 (source: external)
+ // - settings-jdk-21 (source: external)
// - settings-os-unix (source: external)
// - settings-property (source: external)
// - settings-file-exists-present (source: external)
@@ -69,6 +70,7 @@ void testSingleMojoNoPom() throws Exception {
// - pom-jdk-8 (source: org.apache.maven.its.mng7737:test:0.1)
// - pom-jdk-11 (source: org.apache.maven.its.mng7737:test:0.1)
// - pom-jdk-17 (source: org.apache.maven.its.mng7737:test:0.1)
+ // - pom-jdk-21 (source: org.apache.maven.its.mng7737:test:0.1)
// - pom-os-unix (source: org.apache.maven.its.mng7737:test:0.1)
// - pom-property (source: org.apache.maven.its.mng7737:test:0.1)
// - pom-file-exists-present (source: org.apache.maven.its.mng7737:test:0.1)
diff --git a/its/core-it-suite/src/test/resources/mng-7587-jsr330/plugin/pom.xml b/its/core-it-suite/src/test/resources/mng-7587-jsr330/plugin/pom.xml
index 744b809e9c12..1c153acfc495 100644
--- a/its/core-it-suite/src/test/resources/mng-7587-jsr330/plugin/pom.xml
+++ b/its/core-it-suite/src/test/resources/mng-7587-jsr330/plugin/pom.xml
@@ -69,7 +69,7 @@
org.apache.maven.plugins
maven-compiler-plugin
- 17
+ 21
diff --git a/its/core-it-suite/src/test/resources/mng-7737-profiles/pom.xml b/its/core-it-suite/src/test/resources/mng-7737-profiles/pom.xml
index 213635cdfe03..396fc84df554 100644
--- a/its/core-it-suite/src/test/resources/mng-7737-profiles/pom.xml
+++ b/its/core-it-suite/src/test/resources/mng-7737-profiles/pom.xml
@@ -58,6 +58,12 @@ under the License.
[17,)
+
+ pom-jdk-21
+
+ [21,)
+
+
pom-os-unix
diff --git a/its/core-it-suite/src/test/resources/mng-7737-profiles/settings.xml b/its/core-it-suite/src/test/resources/mng-7737-profiles/settings.xml
index 736656a7fbd3..59a27642ecf4 100644
--- a/its/core-it-suite/src/test/resources/mng-7737-profiles/settings.xml
+++ b/its/core-it-suite/src/test/resources/mng-7737-profiles/settings.xml
@@ -48,6 +48,12 @@ under the License.
[17,)
+
+ settings-jdk-21
+
+ [21,)
+
+
settings-os-unix
diff --git a/its/core-it-suite/src/test/resources/mng-8336-unknown-packaging/pom.xml b/its/core-it-suite/src/test/resources/mng-8336-unknown-packaging/pom.xml
index f864f104f84d..c853fa68cfa5 100644
--- a/its/core-it-suite/src/test/resources/mng-8336-unknown-packaging/pom.xml
+++ b/its/core-it-suite/src/test/resources/mng-8336-unknown-packaging/pom.xml
@@ -5,7 +5,7 @@
maven-repro
0.0.1-SNAPSHOT
- 17
+ 21
@@ -20,7 +20,7 @@
maven-compiler-plugin
3.13.0
- 17
+ 21
diff --git a/its/core-it-suite/src/test/resources/mng-8461/extension/pom.xml b/its/core-it-suite/src/test/resources/mng-8461/extension/pom.xml
index 592f459d48a2..79b9154fa046 100644
--- a/its/core-it-suite/src/test/resources/mng-8461/extension/pom.xml
+++ b/its/core-it-suite/src/test/resources/mng-8461/extension/pom.xml
@@ -7,8 +7,8 @@
1.0-SNAPSHOT
- 17
- 17
+ 21
+ 21
UTF-8
diff --git a/its/core-it-suite/src/test/resources/mng-8525-maven-di-plugin/pom.xml b/its/core-it-suite/src/test/resources/mng-8525-maven-di-plugin/pom.xml
index 5b3dac0ee10a..f8af126b2960 100644
--- a/its/core-it-suite/src/test/resources/mng-8525-maven-di-plugin/pom.xml
+++ b/its/core-it-suite/src/test/resources/mng-8525-maven-di-plugin/pom.xml
@@ -30,7 +30,7 @@ under the License.
UTF-8
- 17
+ 21
6.0.0
4.0.0-beta-5
4.0.0-beta-1
diff --git a/its/core-it-suite/src/test/resources/mng-8527-consumer-pom/pom.xml b/its/core-it-suite/src/test/resources/mng-8527-consumer-pom/pom.xml
index f1c79f062d41..c99cf41d08cd 100644
--- a/its/core-it-suite/src/test/resources/mng-8527-consumer-pom/pom.xml
+++ b/its/core-it-suite/src/test/resources/mng-8527-consumer-pom/pom.xml
@@ -37,7 +37,7 @@ under the License.
4.0.0-rc-2
- 17
+ 21
diff --git a/pom.xml b/pom.xml
index 9930e3c82e36..85afa5fe25c3 100644
--- a/pom.xml
+++ b/pom.xml
@@ -128,7 +128,7 @@ under the License.
- 17
+ 21
${javaVersion}
${javaVersion}
${javaVersion}
@@ -880,7 +880,7 @@ under the License.
- [17,)
+ [21,)
${maven.compiler.release}