Re: Installing Maven with OpenJDK 11, without pulling OpenJDK 1.8

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



On 11/23/19 12:24 AM, Mathieu Baudier wrote:
Hello,

I am trying to create a container image which will build Java software with
Maven and Java 11 (rather focussing on CentOS 8 here).

When installing 'maven' with yum, 'java-1.8.0-openjdk-devel' is installed
as a dependency. If one then installs 'java-11-openjdk-devel', and use the
update-alternatives command for java and javac, everything works fine and
Maven uses Java 11 for the build.

But I would like to avoid shipping OpenJDK 1.8 with the image, since it
would uselessly double its size. An approach would be to install Maven
manually, but it feels better to use the provided package.

Looking at the spec file, I understand that the 'maven' package requires
'java-devel' without explicitly specifying a version.
Is there some way (configuration, yum option, alternative, etc.) to make
OpenJDK 11 satisfying this dependency?
Could the new modules / app stream approach of CentOS 8 help here?

This is of course a more general RPM / yum question, but I suspect that the
Java use case is a recurring one, as many of us are currently upgrading
from 1.8 to 11.

Thanks in advance for hints, or telling me that there is no way to achieve
this,

Well, java-11-openjdk-devel only provides 'java-11-devel', so it can't satisfy the 'java-devel' dependency. It does seem like it would be possible to produce a maven module and/or stream that was built with Java 11 and requires it. You could also create a shim rpm that required java-11-devel and provided java-devel.

I'll also note that maven.spec has:

# Theoretically Maven might be usable with just JRE, but typical Maven
# workflow requires full JDK, so we recommend it here.
%{?fedora:Recommends}%{!?fedora:Requires}: java-devel

Which wasn't updated for RHEL8 (which support weak dependencies). I would suggest filing a bug against RHEL8 to get them to fix that. Then you could simply disable installing "recommends" by default.


--
Orion Poplawski
Manager of NWRA Technical Systems          720-772-5637
NWRA, Boulder/CoRA Office             FAX: 303-415-9702
3380 Mitchell Lane                       orion@xxxxxxxx
Boulder, CO 80301                 https://www.nwra.com/

_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
https://lists.centos.org/mailman/listinfo/centos



[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]


  Powered by Linux