Gradle environment issue (Failed to create parent directory)
Answered
New here. Trying to run simple Spring project locally. I have a .gradle folder within my $HOME folder, but IJ doesn't seem to find it when run.
Error is: Failed to create parent directory '/.gradle'
MacBook (Big Sur 11.4)
Using IJ 2021.1.3 Community Edition.
SpringBoot 2.5.2
Java 8
Gradle (wrapper) 7.1.1
Many thanks.
Please sign in to leave a comment.
Does the issue occur only in IntelliJ IDEA or in the system terminal as well when you try to build it using ./gradlew build?
Can you share a sample project to reproduce the issue at https://uploads.jetbrains.com?
Did you modify any Gradle environmen/configuration?
Do you have permissions to write into the home .gradle directory and in the .gradle directory inside the project?
Thank you.
./gradlew build and ./gradlew bootRun produce a good result from command line. My Spring Boot app is up and running with that.
To my knowledge, it's been a while since I have modified (or used) my local Gradle configuration. All permissions for my project dir appear to be under my chown-ership, as well as in $HOME/.gradle.
Uploaded project: 2021_07_23_3qqB39SGrEBXcDra
Does it help if you specify a different Gradle user home at Settings (Preferences on macOS) | Build, Execution, Deployment | Build Tools | Gradle | Gradle user home?
Thank you. Tried to install gradle with brew and point to a different home but to no avail. Same error message.
Please share the screenshot with the Gradle settings and the logs via Help | Collect Logs and Diagnostic Data.
Screenshot + logs: 2021_07_23_QVVt2NYWjLGWWon4
It looks like Gradle is trying to create /.gradle inside the partition root instead of the project root for some reason.
Does the issue persist if you start IntelliJ IDEA from the terminal where command line Gradle works? See https://intellij-support.jetbrains.com/hc/en-us/articles/360011901879-How-to-start-IDE-from-the-command-line.
How exactly are you trying to run Spring project from IDEA (e.g., by invoking a Gradle task, or using Spring run configuration)? Could you please post a screenshot ?