Skip to content

Possibly false positive or a misleading message "Gradle is not using JAVA_HOME" if JAVA_HOME is a symlinkΒ #367

@climategadgets

Description

@climategadgets

Action Taken

./gradlew build

Expected Result

Build passes without Gradle Doctor warnings

Actual Result

Gradle doctor issues the following message (on both first and subsequent daemon runs):

=============================== Gradle Doctor Prescriptions ============================================
| Gradle is not using JAVA_HOME.                                                                       |
| JAVA_HOME is /opt/homebrew/opt/openjdk@17                                                            |
| Gradle is using /opt/homebrew/Cellar/openjdk@17/17.0.12/libexec/openjdk.jdk/Contents/Home            |
| This can slow down your build significantly when switching from Android Studio to the terminal.      |
| To fix: Project Structure -> JDK Location.                                                           |
| Set this to your JAVA_HOME.                                                                          |
|                                                                                                      |
========================================================================================================

Additional Information

OS version: Sonoma 14.5
Gradle version: 8.7
Gradle Doctor version: 0.9.2, 0.10.0
JDK installation method: Homebrew
Multiple Gradle daemons are not started during subsequent runs

Additional Considerations

There are two options: either Gradle itself realizes it is possible to have symlinks to the same final location and starts one daemon per actual JDK, or it doesn't. In the former case the problem lies with Gradle Doctor and its logic should be adjusted to recognize the situation, in the latter with Gradle and then there's one recourse short of fixing the issue in Gradle, and that is - change the message to explain to the user what is going on. The way the warning is currently worded does not suggest this particular problem is recognized, even though it is technically correct.

Related Issues

It looks like something similar was already reported in #187.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions