Bug 1810950 - Maven package requires JDK 8 specifically and ignores alternatives [NEEDINFO]
Summary: Maven package requires JDK 8 specifically and ignores alternatives
Alias: None
Product: Fedora
Classification: Fedora
Component: maven
Version: rawhide
Hardware: All
OS: Linux
Target Milestone: ---
Assignee: Stewardship SIG
QA Contact: Fedora Extras Quality Assurance
Depends On:
TreeView+ depends on / blocked
Reported: 2020-03-06 09:37 UTC by Tristan Deloche
Modified: 2020-03-31 15:14 UTC (History)
8 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Last Closed: 2020-03-31 15:14:25 UTC
Type: Bug
ascheel: needinfo? (tristandeloche)

Attachments (Terms of Use)

Description Tristan Deloche 2020-03-06 09:37:19 UTC
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

And in /usr/share/java-utils/java-functions we have, amongst others:

    case "${_prefer_jre}" in

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.

Comment 1 Tristan Deloche 2020-03-06 09:39:04 UTC
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.

Comment 2 Miro Hrončok 2020-03-06 09:45:05 UTC
Could you run the following command please?

 $ rpm -q maven

Comment 3 Alex Scheel 2020-03-17 16:32:23 UTC
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).

Comment 4 Alex Scheel 2020-03-31 15:14:25 UTC
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.

Note You need to log in before you can comment on or make changes to this bug.