I looked at the spec for maven here:
https://src.fedoraproject.org/rpms/maven/blob/rawhide/f/maven.spec
and it seems like there are packages to tell maven what java version to use. So for example, if you want maven to use OpenJDK 11, you’d install the maven-openjdk11
package. This sets the config file:
$ rpm -qf /etc/java/maven.conf
maven-openjdk11-3.6.3-12.fc35.noarch
So, to use OpenJDK 17, you’d use:
$ sudo dnf install maven-openjdk17 --allowerasing
which will replace the maven-openjdk11 package with maven-openjdk17 and give you the expected output:
$ mvn -version
Apache Maven 3.6.3 (Red Hat 3.6.3-12)
Maven home: /usr/share/maven
Java version: 17.0.1, vendor: Red Hat, Inc., runtime: /usr/lib/jvm/java-17-openjdk-17.0.1.0.12-1.rolling.fc35.x86_64
Default locale: en_GB, platform encoding: UTF-8
OS name: "linux", version: "5.14.15-300.fc35.x86_64", arch: "amd64", family: "unix"
So, it’s not a bug. It’s just a package based way of allowing users to choose what java version they want maven to use.
What could be done is to add a README or something to tell users about these packages. Maybe it’s in the documentation somewhere, but I haven’t looked.