Hi all, While working on improving compatibility of the tomcat package with third-party Java runtimes [1] (i.e. Eclipse Adoptium [2]), I ran into a persistent and somewhat opaque behavior in Fedora’s Java stack that leads DNF to always install java-21-openjdk-headless, even when a valid third-party JRE is already installed and provides the expected.
When installing tomcat, I observed that *dnf pulls in java-21-openjdk-headless* even though the relevant spec file has been modified with the relaxed dependency of *Requires: (jre-headless or jre)*. I already have temurin-21-jre installed, which provides: *jre-headless and jre.*Running *dnf install jre-headless* correctly resolves to nothing (already satisfied). After investigation, I found out that java-21-openjdk-headless is required by ecj, which is required by tomcat. I inspected the spec file of ecj and initially, I suspected the %jpackage_script <https://src.fedoraproject.org/rpms/ecj/blob/f42/f/ecj.spec#_62> macro was injecting the dependency. But even after commenting out that macro in ecj.spec and building locally, the behavior persisted. Although I didn't dig deeper, I suspect some maven macros are injecting that dependency. The above result in two noteworthy matters: 1) Even if a package like tomcat is fully compatible with third-party Java runtimes, its dependencies (like ecj) defeat that compatibility silently. 2) Users trying to use supported alternatives like Temurin will always get Fedora’s OpenJDK installed unless they use non-obvious flags like: dnf install tomcat --exclude='java*-openjdk*' and two questions: 1) Should macros automatically inject dependencies, or should this be made overridable? 2) Would it be more appropriate for packages like ecj to declare a more neutral dependency, such as: Requires: (java-headless or jre-headless) ? And other than that, there still exists the need for versioned Temurin rpms as discussed here <https://github.com/adoptium/installer/issues/848#issuecomment-2133516101>. I’d be happy to open a bug, but I wanted to raise this for discussion first to see if others have encountered the same challenge or have best practices to suggest. Thanks for your time and input. P.S. Such cases were what I was worrying about and I mentioned at the discussion <https://discussion.fedoraproject.org/t/f42-change-proposal-third-party-legacy-jdks-system-wide/132049/5> of the proposal :) Kind regards, Dimitris Soumis [1] Relevant BZ#2374859 <https://bugzilla.redhat.com/show_bug.cgi?id=2374859> [2] change proposal <https://fedoraproject.org/wiki/Changes/ThirdPartyLegacyJdks>
-- _______________________________________________ devel mailing list -- devel@lists.fedoraproject.org To unsubscribe send an email to devel-le...@lists.fedoraproject.org Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue