plugins {
id("com.osacky.doctor") version "0.7.1"
}
Este formato sigue la estructura que propusiste, con la información distribuida de manera clara y directa.
Gradle Doctor Prescriptions: Gradle is not using JAVA_HOME.
Gradle is using /snap/intellij-idea-community/515/jbr.
To fix: Project Structure -> JDK Location.
Set this to your JAVA_HOME.
Explicación sobre qué es JAVA_HOME y qué se necesita hacer.
you will get an error like this
> =============================== Gradle Doctor Prescriptions ============================================
| Gradle is not using JAVA_HOME. |
| JAVA_HOME is /usr/lib/jvm/java-11-openjdk-amd64 |
| Gradle is using /usr/lib/jvm/java-17-openjdk-amd64 |
| 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. |
| |
========================================================================================================
This gradle doctor code will crash your build until you figure out how to get gradle to use the same reference as JAVA_HOME
There is not alot of community support on this topic and
we attempted to change the JAVA_HOME in the ~/.bashrc and ~/.profile with
export JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64
export PATH=$JAVA_HOME/bin:$PATH
We will then run the source ~/.bashrc
We will then run the source ~/.profile
this did not work. we still would get an issue from gradle doctor and the build would crash.
the issue in the error is that gradle needs to be changed. it needs to look for the correct JAVA_HOME
inside intellij you can click on the little gradle elephant in the right corner and select the corresponding preferences item from the it's menu.
Doing so will open up Build, Execution, Deployment > Build Tools > Gradle
I am still menu diving and trying to figure out the right selection to select. but in the process i learned something very important.
Sure we would like to be more in control of gradle and have great tooling to understand our build process better.
but there are built into gradle ways of debugging and exploring this build system.
gradle --scan
gradle --info
gradle --debug
gradle --stacktrace
You can also add logging directly in your build.gradle file using println statements.