View Issue Details

IDProjectCategoryView StatusLast Update
0018434CentOS-8mavenpublic2022-04-18 04:44
Reportercarofe82 Assigned To 
PrioritynormalSeverityminorReproducibilityalways
Status newResolutionopen 
Product Version8.4.2105 
Summary0018434: The package maven-openjdk11 sets JAVA_HOME in /etc/java/maven.conf incorrectly when using temurin 11 jdk breaking mvn
DescriptionThe package maven-openjdk11 sets JAVA_HOME in /etc/java/maven.conf incorrectly when using temurin jdk. However, the mvn script provided by maven can perfectly work without the JAVA_HOME being set. It uses "which java" to identify the installed JDK. The Steps to Reproduce shows the bug, and also how truncating the /etc/java/maven.conf file solves the issue.

Would it make sense to remove the setting of JAVA_HOME from the package and leave it as something optional?
I could try to submit a patch to remove JAVA_HOME from the maven-openjdk11 package if that's the direction the project wants to go.
I believe is in here https://git.centos.org/rpms/maven/blob/c8s-stream-3.6/f/SPECS/maven.spec
Steps To ReproduceHow to Reproduce:

$ podman run -it --rm redhat/ubi8 /bin/bash

# cat <<EOF > /etc/yum.repos.d/adoptium.repo
[Adoptium]
name=Adoptium
baseurl=https://packages.adoptium.net/artifactory/rpm/rhel/8/$(uname -m)
enabled=1
gpgcheck=1
gpgkey=https://packages.adoptium.net/artifactory/api/gpg/key/public
EOF

# dnf install -y temurin-11-jdk
# dnf module -y enable maven:3.6
# dnf install -y maven
# mvn --version
The JAVA_HOME environment variable is not defined correctly
This environment variable is needed to run this program
NB: JAVA_HOME should point to a JDK not a JRE

# ls /usr/lib/jvm/
temurin-11-jdk

# JAVA_HOME=/usr/lib/jvm/temurin-11-jdk/ mvn
The JAVA_HOME environment variable is not defined correctly
This environment variable is needed to run this program
NB: JAVA_HOME should point to a JDK not a JRE

# cat /etc/java/maven.conf
JAVA_HOME=/usr/lib/jvm/java-11-openjdk

# dnf whatprovides /etc/java/maven.conf
Last metadata expiration check: 0:06:53 ago on Sun Apr 17 04:18:42 2022.
maven-openjdk11-1:3.6.2-6.module+el8.4.0+9250+1786af37.noarch : OpenJDK 11 binding for Maven
Repo : ubi-8-appstream
Matched from:
Filename : /etc/java/maven.conf

# truncate -s 0 /etc/java/maven.conf

# mvn --version
Apache Maven 3.6.2 (Red Hat 3.6.2-6)
Maven home: /usr/share/maven
Java version: 11.0.14.1, vendor: Eclipse Adoptium, runtime: /usr/lib/jvm/temurin-11-jdk
Default locale: en, platform encoding: UTF-8
OS name: "linux", version: "5.16.19-200.fc35.x86_64", arch: "amd64", family: "unix"
TagsNo tags attached.

Activities

carofe82

carofe82

2022-04-18 04:44

reporter   ~0038913

I reported the issue in redhat https://bugzilla.redhat.com/show_bug.cgi?id=2076114.

Issue History

Date Modified Username Field Change
2022-04-17 04:35 carofe82 New Issue
2022-04-18 04:44 carofe82 Note Added: 0038913