How can I access the user's home directory?

I’m attempting to use Gradle in a project that currently uses SBT. By default, SBT deploys its artefacts to $HOME/.ivy2. I have a few locally-modified SBT projects which I’m deploying to this local directory, and my SBT projects pick these up by default. Unfortunately, Gradle projects don’t.

I’ve been searching Google for this, and keep finding references to GRADLE_USER_HOME. This doesn’t appear to be what I want.

Is there a way to access my home directory so I can do something like:

repositories {

ivy { url “$USER_HOME/.ivy2” } }

Thanks.

you can always use

System.getProperty("user.home")

to get the user home directory. This is a java, not a specific gradle functionality.

regards, René

1 Like