Bug 1925638

Summary: Ant fails to use the java jvm configured by the alternatives command
Product: [Fedora] Fedora Reporter: Bill Chatfield <bill_chatfield>
Component: antAssignee: Mikolaj Izdebski <mizdebsk>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 33CC: decathorpe, jaromir.capik, java-maint-sig, java-sig-commits, mizdebsk, msrb
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-04-28 10:33:19 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Bill Chatfield 2021-02-05 18:57:39 UTC
Description of problem:

Ant does not use the version of java configured by the alternatives command. It uses bash functions that are part of javapackages-tools to determine which java command to run instead of just using the java I told it to use with the alternatives commands. Furthermore, there should only be one method of determining which java to run. The alternatives system and the functions in javapackages-tools are redundant. One of them needs to be removed.




Version-Release number of selected component (if applicable):

ant-1.10.9-1.fc33




How reproducible:

Configure java 1.8 with the alternatives command and then run an ant build.




Steps to Reproduce:
1. sudo dnf -y install java-11-openjdk-devel java-1.8.0-openjdk-devel javapackages-tools
2. sudo alternatives --set java java-1.8.0-openjdk.x86_64
3. echo '<project> <echo message="java.home=${java.home}"/> </project>' | cat > build.xml
4. ant



Actual results: (ant using java 11 after 1.8 was configured)

Buildfile: /home/bill/build.xml
     [echo] java.home=/usr/lib/jvm/java-11-openjdk-11.0.9.11-9.fc33.x86_64

BUILD SUCCESSFUL
Total time: 0 seconds




Expected results: (ant should be using 1.8)

Buildfile: /home/bill/build.xml
     [echo] java.home=/usr/lib/jvm/java-1.8-openjdk...

BUILD SUCCESSFUL
Total time: 0 seconds




Additional info:

Comment 1 Fedora Admin user for bugzilla script actions 2021-04-28 00:03:48 UTC
This package has changed maintainer in Fedora. Reassigning to the new maintainer of this component.

Comment 2 Mikolaj Izdebski 2021-04-28 10:33:19 UTC
It is expected that Ant does not rely on alternatives for choosing JVM to use.
This is described in more detail at https://fedoraproject.org/wiki/Changes/Decouple_system_java_setting_from_java_command_setting
JVM used by Ant can be changed in configuration files.