[Bug 293756] Mk/Uses/java.mk: prefer latest LTS openjdk

From: <bugzilla-noreply_at_freebsd.org>
Date: Thu, 12 Mar 2026 11:25:23 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=293756

            Bug ID: 293756
           Summary: Mk/Uses/java.mk: prefer latest LTS openjdk
           Product: Ports & Packages
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: Ports Framework
          Assignee: portmgr@FreeBSD.org
          Reporter: ronald@FreeBSD.org
                CC: ports-bugs@FreeBSD.org

Created attachment 268746
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=268746&action=edit
git diff to change the order of preferred java version

I want to get some feedback on a proposal for a change on which JDK is
preferred in ports.

The idea came from talks in bug #289858 and bug #293467 with ideas about
picking a preferred JDK.

My proposal patch is attached.

The idea explained, I hope I can explain it good enough:

Current situation:
1. If no JAVA_VERSION is defined, ports picks JAVA_DEFAULT (currently 21); this
is a simple case and is fine as it is.
2. JAVA_VERSION=17, is a specific value. This is clear and fine.
3. JAVA_VERSION=8 11 17 or JAVA_VERSION=17+, for a range java.mk currently
picks the lowest number. So here it pick 8 and 17 respectively.

New situation:
1. no JAVA_VERSION defined, still JAVA_DEFAULT is used; no changes, this is
fine.
2. JAVA_VERSION=17, nothing change, this is fine.
3. JAVA_VERSION=8 11 17 or JAVA_VERSION=17+, for a range java.mk will now pick
the highest LTS version. In the example above we will now pick 17 (for 8 11 17)
and 25 (for 17+).

I think this encourages using modern software on FreeBSD. To me it looks like a
relative small change, but a nice step forward.

Some notes:
- I tested that in the current state of the ports tree all java ports still
compile fine.
- The USES=java mechanism of looking for installed JDKs still works the same.
If you only install jdk22 and no LTS versions it will pick the jdk22.
- For port maintainers nothing changes. They can still provide a range of
supported Java versions.
- If a user want to use a specific JAVA_VERSION they can still override in
make.conf.

-- 
You are receiving this mail because:
You are on the CC list for the bug.