I have a build.cradle file in the local folder. Whenever I run a cradle command, like cradle tasks
it applies the root project hsperfdata_$UID (where $UID) is my local username. I have no idea, where and what that project is, but it’s definitely not using the local build.cradle
file. How can I change the root project to the one in the present working directory?
Found this through everyone’s favorite search engine. I was frustrated by this, too and found a work around. The JVM is running the gradle daemon in a currentDir
set to the hsperfdata_$UID dir. This is because the JVM has decided to do some sort of optimization (never really figured it out).
FAILED ATTEMPT: Following the config docs, I thought setting org.gradle.jvmargs=-XX:-UsePerfData
in ~/.gradle/gradle.properties
would do disable the hsperfdata, but even stopping the gradle daemon and running gradle properties --stacktrace --debug
showed daemonOpts=-XX:-UsePerfData
as well as currentDir=/blah/blah/blah/hsperfdata_$UID
. In other words, the JVM was probably not receiving the XX:-UsePerfData
option.
SUCCESSFUL ATTEMPT: My next choice was a nuclear option - export another jvm in my JAVA_HOME env var. I installed a few java versions before and thus had a few entries in /usr/libexec/java_home -V
I chose another one of those and exported that export JAVA_HOME=blah/blah/blah/Home
. Gradle ran fine after that
Follow up:
Java was definitely receiving the option -XX:-UsePerfData
as seen in the log entry below:
Starting process 'Gradle build daemon'. Working directory: /Users/rybot/.gradle/daemon/6.7 Command: /Library/Java/JavaVirtualMachines/jdk1.8.0_221.jdk/Contents/Home/bin/java -XX:-UsePerfData -Dfile.encoding=UTF-8 -Duser.country=US -Duser.language=en -Duser.variant -cp /usr/local/Cellar/gradle/6.7/libexec/lib/gradle-launcher-6.7.jar org.gradle.launcher.daemon.bootstrap.GradleDaemon 6.7
Oracle’s Javadocs for v8 say
" Disabling it suppresses the creation of the hsperfdata_userid
directories. To disable the perfdata
feature, specify -XX:-UsePerfData
."
I even rm -rf
'd the hsperfdata_rybot
dir, stopped the daemon, and ran it again to find myself in the same situation: Gradle running in the hsperfdata
dir. So annoying.