When I run the command “./gradlew build”, gradle automatically creates a folder called “?” (question mark) and unzips the gradle wrapper there and also download all the project dependencies into the same folder rather than put it in ~/.m2 folder
I don’t have installed gradle neither maven nor groovy, I’m using the gradle wrapper only
Gradle doesn’t do that normally, so it sounds like some special to your configuration/build.
Gradle doesn’t use ~/.m2 for downloaded dependencies. It keeps a cache in GRADLE_USER_HOME (which is usually ~/.gradle).
Are you seeing wrapper/dists directory in the “?” directory? Could your GRADLE_USER_HOME be set to “?” ? Otherwise, it sounds like maybe your build is doing that as part of one of the build tasks.
Now I installed gradle via gvmtool and I running gradle build directly rather then run it by the wrapper, and same thing happend. If I remove the folder “?”, gradle is creating the folder again and put all the project dependencies there. I check the build.gradle file if there is some setting related to this, but found anything.
Now my GRADLE_USER_HOME is: ~/.gvm/gradle/current
The .gradle folder was created into the folder “?”
Here I put part of the gradles log
Unzipping /home/projects/webRest/?/.gradle/wrapper/dists/gradle-2.3-all/65cghn432lqt7oeaej42642hdj/gradle-2.3-all.zip to /home/projects/webRest/?/.gradle/wrapper/dists/gradle-2.3-all/65cghn432lqt7oeaej42642hdj
Set executable permissions for: /home/projects/webRest/?/.gradle/wrapper/dists/gradle-2.3-all/65cghn432lqt7oeaej42642hdj/gradle-2.3/bin/gradle
As you can see gradle is being unziped into folder “?”, that, at the same time exists into the application folder which is webRest
I’ve had the same problem inside a docker container. Setting the GRADLE_USER_HOME variable should work, but you can have the same ./? directory problem with the location of the .m2 directory, for example.
I’ve solved the problem setting the user.home java system property. It seems that gradle, grails and maven (for example) use that property to build the path to their directories, so just try