proposal for preferred jdk in ports
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 12 Mar 2026 11:36:23 UTC
Hi, I want to get some feedback on a proposal in a change on which JDK is preferred in ports. https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=293756 The idea came from talks in other PRs with ideas about picking a preferred JDK. My proposal is attachment: https://bugs.freebsd.org/bugzilla/attachment.cgi?id=268746&action=diff <https://bugs.freebsd.org/bugzilla/attachment.cgi?id=268746&action=diff>. The idea explained. I hope I can explain it good enough. TL;DR: prefer latest LTS JDK instead of oldest JDK from the support range. 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. If JAVA_VERSION is a range like JAVA_VERSION=8 11 17 or JAVA_VERSION=17+, ports 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. if JAVA_VERSION is a range we 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 better matches using modern software. 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. In the PR might be a little more elaborate explanation. I hope people find this proposal; simple enough to adopt without to much risky changes. Regards, Ronald.