Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RPM doesn't allow to use Java 11 #33

Open
ViliusS opened this issue Apr 3, 2024 · 7 comments
Open

RPM doesn't allow to use Java 11 #33

ViliusS opened this issue Apr 3, 2024 · 7 comments

Comments

@ViliusS
Copy link

ViliusS commented Apr 3, 2024

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
Copy link
Contributor

bhamail commented Apr 23, 2024

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
Copy link
Author

ViliusS commented Apr 23, 2024

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
Copy link
Contributor

bhamail commented Apr 23, 2024

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
Copy link
Author

ViliusS commented Apr 28, 2024

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 sonatype/nexus-public#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
Copy link
Contributor

bhamail commented Apr 30, 2024

@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
Copy link
Author

ViliusS commented Apr 30, 2024

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
Copy link

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:

  • nexus-3.68.1-02/install4j/i4jparams.conf
  • nexus-3.68.1-02/nexus/nexus
  • nexus-3.68.1-02/nexus/nexus.vmoptions

i4jparams.conf:

  • variable sys.setName is different (unix-archive/java8 to unix-archive/java11)
  • Some references in the XML itself are different (mainly ids for launch4j, seem to be auto generated)

nexus (the bash script for starting nexus)

  • Short Description is different (nexus.java8 to nexus.java11)
  • The Parameter "-Dinstall4j.launcherId" changed from 245 to 246, couldn't find it in the i4jparams file, seems to be auto generated

nexus.vmoptions:

  • in the java 8 version, all the add-reads, add-opens etc lines are commented out, an a single line is added: -Djava.endorsed.dirs=lib/endorsed
  • in the java 11 version all the add-reads, add-opens etc lines are commented in and the parameter java.endorsed.dirs is removed

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants