Gradle not working in intelliJ Idea
IntelliJ IDEA 2022.1.3 (Community Edition)
Build #IC-221.5921.22, built on June 21, 2022
Runtime version: 11.0.15+10-b2043.56 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Dear Team,
I have have recently upgraded my intelliJ idea from 2018 to 2022 version. Also, I have upgraded my java version from Oracle Jdk8 to Microsoft Build of OpenJDK 11. Since than I am not able to build my gradle projects. I am able to build the project locally as well in WSL but not from IntelliJ Idea.
I have delete all my JetBrains cache and reconfigured the Project Structure SDK version and Gradle JVM setting. But nothing really helped. Also, there are no errors in console. it just say "project-name: failed".
I even uninstalled and reinstalled the intelliJ Idea but that didn't help also.
Please Help!!
请先登录再写评论。
Please report at https://youtrack.jetbrains.com/newIssue?project=IDEA and attach the logs using Help | Collect Logs and Diagnostic Data.
Thank you Serge Baranov for responding. I think I found the issue. It's related to JAVA_HOME. I have setup correctly everything. However, IntelliJ Idea was trying to access JAVA from wrong place.
After I uninstalled my previous java version(Oracle Jdk8) but there were few files that were left in C:\Program Files\Java. Now, during the configuration even if my IntelliJ idea finds the right sdk(OpenJDK 11) from the correct path(C:\Program Files\Microsoft\jdk-11.0.15.10-hotspot) but at build time it still accessing the same JAVA_HOME from path(C:\Program Files\Java\jdk1.8.0_191\) which was set earlier. Kindly refer the below idea logs.
Current system info:
C:\Users\my-user>echo %JAVA_HOME%.
C:\Program Files\Microsoft\jdk-11.0.15.10-hotspot.
C:\Users\my-user>java --version
openjdk 11.0.15 2022-04-19 LTS
OpenJDK Runtime Environment Microsoft-32930 (build 11.0.15+10-LTS)
OpenJDK 64-Bit Server VM Microsoft-32930 (build 11.0.15+10-LTS, mixed mode)
idea.log:
Now I ran two test here,
- I have moved my JDK from C:\Program Files\Microsoft\jdk-11.0.15.10-hotspot to C:\Program Files\Java\jdk1.8.0_191\ and run the build again. It worked!!!
- I renamed my C:\Program Files\Java to something else and it worked again!!!.
In both cases, I didn't change my Project Structure SDK version and Gradle JVM setting. they were still pointing to the env's JAVA_HOME(C:\Program Files\Microsoft\jdk-11.0.15.10-hotspot).
I am not sure if i am doing something wrong and this has to be reported to the team as a BUG.
If you changed JAVA_HOME environment variable, a reboot is needed for all the apps to see this change.
Gradle JDK in IntelliJ IDEA is also configured separately and you may have some override there: Settings (Preferences on macOS) | Build, Execution, Deployment | Build Tools | Gradle | Gradle JVM: https://i.imgur.com/3vqYo2t.png ..
yup. I have done all that. Rebooted I don't know how many times.
What JDK version is set for Gradle in IntelliJ IDEA?
It was set as 11.
11 as in project JDK? Try configuring the JDK from scratch if you are using project JDK for Gradle: https://stackoverflow.com/a/61180376/104891.
Your JDK named 11 may point to some other JDK path that contains a different version.