Description of problem: Version-Release number of selected component (if applicable): at least since Fedora 31 How reproducible: always reproducible Steps to Reproduce: 1. Install any JDK package that's not 8 (and its "-devel" version) 2. Install maven package (which requires JDK 8) 3. Set the "java" and "javac" alternatives to that other JDK 4. Check "mvn -v", see that it still uses JDK 8 forcefully Actual results: Maven is executed with JDK 8 Expected results: Maven is executed with the JDK set using alternatives (reasonably the one of "javac", but maybe should be another alternative alias as its a jdk reference rather than one to the javac binary) Additional info: Assuming no JAVA_HOME, no .mavenrc etc, the /usr/bin/mvn script has the following line: if [ -f /usr/share/java-utils/java-functions ] ; then . /usr/share/java-utils/java-functions set_jvm set_javacmd fi And in /usr/share/java-utils/java-functions we have, amongst others: ... case "${_prefer_jre}" in 1|[Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]) dirs="/usr/lib/jvm/jre-1.8.0-openjdk:/usr/lib/jvm/java-1.8.0-openjdk" ;; *) dirs="/usr/lib/jvm/java-1.8.0-openjdk:/usr/lib/jvm/jre-1.8.0-openjdk" ;; esac ... Meaning that assuming no override, we will always use the JDK 8 installed as a dependency of maven, ignoring any user system-wide Java alternative setting.
Note that, on top of this, the dependency on Java 8 *explicitly* is quite awkward ; it should at best be required only if nothing installed provides Java yet, and even then it probably makes more sense to just use the latest JDK for the current release version.
Could you run the following command please? $ rpm -q maven
Additionally, why is this an issue? Having multiple JDKs won't matter and ensuring mvn gets run consistently IMO, is far better than having to support whatever custom JDK the user has installed (IBM? Oracle? &c).
No response in a bit. Per Maven packaging, this is expected behavior. This follows other packaging in distros, e.g., Python packaging using the system python. We can only reasonably support the default JDK; other third-party JDKs aren't supported. CLOSING->WONTFIX.
The needinfo request[s] on this closed bug have been removed as they have been unresolved for 1000 days