maven and java_home?
- Reply: Harald Eilertsen : "Re: maven and java_home?"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 05 Feb 2026 08:52:13 UTC
Hi, When a port defines JAVA_VERSION but during the build multiple jdk versions are installed, maven does not use the defined version if JAVA_HOME is not set in the environment. I found this while pinning ports to openjdk8 and defining JAVA_DEFAULT=21 [1]. Dependencies install openjdk21 as run_dep which is picked up by maven, although JAVA_VERSION of the current build is 8. The patch in the attachment makes sure JAVA_HOME is set. This fixes the builds. I used this to find the relevant ports. find . -name Makefile | xargs grep -l bin/mvn | xargs grep -L JAVA_HOME NB: for ant we set a similar MAKE_ENV in Mk/Uses/java.mk. It might be a nice follow up task to add maven support to java.mk. I first want to get JAVA_DEFAULT=21 in the ports tree. Is it possible to get some java@ approval for such a change without going through the hassle of creating separate PRs for every port? Regards, Ronald. [1] https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=272855