-
Notifications
You must be signed in to change notification settings - Fork 30
Description
New feature, improvement proposal
Currently the following locations are scanned for auto-discovery as described in the ToolchainDiscoverer:
Generically
$HOME/.jdks$HOME/.m2/jdks$HOME/.sdkman/candidates/java$HOME/.gradle/jdks$HOME/.jenv/versions$HOME/.jbang/cache/jdks$HOME/.asdf/installs$HOME/.jabba/jdk
macOS
/Library/Java/JavaVirtualMachines$HOME/Library/Java/JavaVirtualMachines
Linux
/usr/jdk/usr/java/opt/java/usr/lib/jvm
Windows
C:\Program Files\Java$HOME\scoop\apps
I would like to see the following locations added for auto-discovery:
Generically
$HOME/.local/share/mise/installs/javato support mise (an alternative to asdf)
Beyond that many of the generic tools (ASDF ASDF_DATA_DIR, mise MISE_DATA_DIR, Jabba JABBA_HOME, SDKMAN SDKMAN_CANDIDATES_DIR, jenv JENV_ROOT) can be configured via environment variables that change the location of where tools are installed.
It would probably be a good addition to consider these variables when scanning for Java locations.
macOS
$HOME/hostedtoolcache(/Users/runner/hostedtoolcache) to support arbitrary JDKs installed in GitHub Workflows using actions/setup-java
Linux
/opt/hostedtoolcacheto support arbitrary JDKs installed in GitHub Workflows using actions/setup-java/usr/lib64/jvmto align with Gradle Linux discovery,/lib<qual>is FHS standard (see here and here)/usr/local/javato align with Gradle Linux discovery
Windows
C:\hostedtoolcache\windowsto support arbitrary JDKs installed in GitHub Workflows using actions/setup-java
For Windows (similar to what Gradle does for its Toolchain discovery) it would potentially be interesting to check the registry as well.
Why explicitly add support for GitHub when the setup-java action already creates a static toolchains.xml? Because they behave differently than the auto-discovered ones, particularly for older JDKs (up until the version name change from 1.x to x), concerning version names that can be selected. This makes usage cumbersome, if people locally have not setup toolchains as well.