Bug 1897375

Summary: maven latest upgrade introduced hard dependency on /etc/java/maven.conf
Product: Red Hat Enterprise Linux 8 Reporter: Tuomo Soini <tis>
Component: maven-3.6-moduleAssignee: Mikolaj Izdebski <mizdebsk>
Status: CLOSED ERRATA QA Contact: Martin Kyral <mkyral>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 8.3CC: jorton, mizdebsk, mkyral, pasik, pasteur
Target Milestone: rcKeywords: Triaged
Target Release: 8.4   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: maven-3.6-8040020201224090117.14342f08 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-05-18 15:56:32 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 Tuomo Soini 2020-11-12 21:45:46 UTC
Description of problem:

maven:3.6 maven package upgrade removed dependency on javapackage-tools but accidentally test for exitence of /etc/java/maven.conf was removed and now maven-lib actually requires /etc/java/maven.conf.

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

3.6.2-5.module+el8.3.0+6804+157bd82e

How reproducible:

Always.

Steps to Reproduce:

/usr/share/maven/bin/mvn: line 36: /etc/java/maven.conf: No such file or directory

Expected results:

/usr/share/maven/bin/mvn to work...

Additional info:

https://git.centos.org/rpms/maven/c/e0174bfb093f71c290478be97a193f5eb233ffc5?branch=c8-stream-3.6

This part of the change causes hard dependency on /etc/java/maven.conf

- +  if [ -f /etc/java/maven.conf ] ; then
+ +  . /etc/java/maven.conf
- +    . /etc/java/maven.conf
- +  fi 

Either this should be reverted or Necessary require is needed in maven-lib package. If that's the fix you want it would be:

Requires: maven-jdk-binding = %{epoch}:%{version}-%{release}

Or

Requires: /etc/java/maven.conf

Comment 1 Mikolaj Izdebski 2020-11-18 08:20:11 UTC
Thank you for taking the time to report this issue to us. We appreciate the feedback and use reports such as this one to guide our efforts at improving our products. That being said, this bug tracking system is not a mechanism for requesting support, and we are not able to guarantee the timeliness or suitability of a resolution.

If this issue is critical or in any way time sensitive, please raise a ticket through the regular Red Hat support channels to ensure it receives the proper attention and prioritization to assure a timely resolution.

For information on how to contact the Red Hat production support team, please visit:
    https://access.redhat.com/support

I can reproduce the issue with:
# podman run -it registry.access.redhat.com/ubi8
# dnf -y module enable maven:3.6
# dnf -y install maven-lib
# /usr/share/maven/bin/mvn -v
/usr/share/maven/bin/mvn: line 36: /etc/java/maven.conf: No such file or directory

However, as maven-lib description says, it is expected to be used as a library only:
# rpm -qi maven-lib
Description: Core part of Apache Maven that can be used as a library.

Also, maven-lib does not provide mvn command in /usr/bin either, and we have not considered using it the above way as a valid use case for maven-lib.
For use of Maven from command-line, the full maven package should be insalled.
We should move /usr/share/maven/bin/mvn script from maven-lib to maven to make this more obvious.
And I can confirm that installing full maven with "dnf install maven" fixes the above issue with missing config file.

I will keep this bug open for moving the internal mvn shell script /usr/share/maven/bin/mvn from maven-lib to maven package.

Comment 13 errata-xmlrpc 2021-05-18 15:56:32 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (maven:3.6 bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2021:1897