sonatype-nexus-community / nexus-repository-installer

Installer for Nexus Repository Manager 3
Apache License 2.0
32 stars 11 forks source link

RPM doesn't allow to use Java 11 #33

Open ViliusS opened 5 months ago

ViliusS commented 5 months ago

Since 3.67.0 Nexus Repository Manager now support Java 11, however RPM spec file has Java 8 requirement hardcoded.

It's probably best that Nexus Repository Manager RPM would depend on virtual java-headless package which will install default Java environment on the chosen OS. It could be even limited for 8 and 11 versions of Java only, if needed.

The only question is probably to test how this behaves in the current installation. Will it automatically uninstall/reinstall Java version appropriately.

bhamail commented 4 months ago

There are a pile of issues, and I wish I had more time to hammer on them. Here's a few notes and some nasty workarounds I found recently. These are NOT at all true solutions, but thought I'd share in the mean time, in case it helps others:

  1. Apt signatures invalid in apt repo, solution: /etc/apt/sources.list.d/sonatype-community.list: deb [arch=all trusted=yes] https://repo.sonatype.com/repository/community-apt-hosted/ bionic main

    deb [arch=all] https://repo.sonatype.com/repository/community-apt-hosted/ bionic main

    deb https://repo.sonatype.com/repository/community-apt-hosted/ bionic main

  2. Installer ALWAYS installs JDK17 on debian bookworm, even after I install jdk 11 and jdk 8 via sdk man, etc. solution: install (by hand) jdk deb: https://bell-sw.com/pages/downloads/#jdk-8-lts bellsoft-jdk8u412+9-linux-aarch64.deb The installer still installed JDK17, but the nexus startup script managed to find jdk8 and launch successfully.

Any help in finding real solutions to the above is greatly appreciated!

ViliusS commented 4 months ago

I don't know enough about debian so cannot help on the issues you posted, but I can volunteer to work on RPM issue in my original post. Basically the solution is already provided in the comment and I can even prepare a PR for this, but I would need help on how to build the RPM for testing. I see that currently DEB is built from RPM, so I won't be able to test those. The biggest problem I see that I probably won't be able to test how RPM changes affect CI process you are using. This would be a patch more to the build process than a software itself. If you are interested, we could take this to Slack or another channel to discuss how we could collaborate on this issue.

bhamail commented 4 months ago

A PR for the RPM part is most welcome. I don't know how best to update the rpm .spec file to allow for java 8 or 11. Even a PR with a partial solution might help, so please feel free to take a shot at it.

FWIW, there may be some other surprises lurking once java 11 is in use, but we can deal with those as they arise.

As to building the rpm locally, start from here: https://github.com/sonatype-nexus-community/nexus-repository-installer?tab=readme-ov-file#overview: $ make build

(Yes, the .deb is basically just built from the .rpm (via alien), so best to start with a fix for the .rpm first)

ViliusS commented 4 months ago

I've successfully adjusted spec file to pull Java 11 dependency:

[user@host]# dnf reinstall nexus-repository-manager-3.67.1_01-1.el7.noarch.rpm
Last metadata expiration check: 0:00:18 ago on Sun Apr 28 12:28:55 2024.
Dependencies resolved.
=============================================================================================================================================================================================
 Package                                               Architecture                        Version                                           Repository                                 Size
=============================================================================================================================================================================================
Reinstalling:
 nexus-repository-manager                              noarch                              3.67.1_01-1.el7                                   @commandline                              210 M
Installing dependencies:
 alsa-lib                                              x86_64                              1.2.9-1.el9                                       appstream                                 499 k
 java-11-openjdk-headless                              x86_64                              1:11.0.23.0.9-3.el9                               appstream                                  40 M

Transaction Summary
=============================================================================================================================================================================================
Install  2 Packages

Total size: 250 M
Total download size: 40 M
Installed size: 420 M
Is this ok [y/N]:

However, there is seems another issue. There are two different Nexus Repository binaries which should be used for different Java support https://help.sonatype.com/en/download.html . I have inquired here https://github.com/sonatype/nexus-public/issues/118 for confirmation how it is different, but from what it looks either RPM with Java 11 support needs to be released under new name, or we must switch RPM to only support Java 11 and inform users that some older OSes are not supported anymore. What do you think?

bhamail commented 4 months ago

@ViliusS As mentioned in that other issue, there are still some "Java 9+" options/changes required for startup that I'm not sure we want to dive into just yet. Those might be related to the reason multiple downloads are currently needed. I also saw mention in the other thread that OrientDB is limited to Java11. All that said, I'm wondering how deep we want to go into the Java 11 woods right now, and wondering if it makes sense to wait a bit longer and maybe things will get better for 11+? (I don't have any inside info on this - pure speculation on my part).

ViliusS commented 4 months ago

Let's wait for the answer in that other issue, and see how the binaries are actually different.

Even if Nexus will be compatible with Java 17 at some point in the future, I still think there will be a need to decide on: 1) What minimum OS to target with RPM. EL7 has Java 11 packages, but I do not believe older operating OSes do. 2) The upgrade path. Do we mark current package as obsolete and rename new RPM with Java 11 support, so it gets reinstalled properly on upgrade, or do we release different RPM with Java 11 support and keep current package for those who are still standardized on Java 8 in their environment.

darenkster commented 3 months ago

Hi there, FWIW I compared the nexus-3.68.1-02 Java 11 and nexus-3.68.1-02 Java 8 with Total Commander.

Three files are different:

i4jparams.conf:

nexus (the bash script for starting nexus)

nexus.vmoptions:

This seems to be it, all the other files are the same.