How to specify relative path to local Ivy repo in Gradle?

I am switching from Ant / Ivy to Gradle and trying to understand how you are specifying the relative path to the local Ivy repo. Stand-alone Ivy sets the default variable ${ivy.default.ivy.user.dir} to .ivy2 in the user's home directory and places the local repo there.

I can mimic this as follows:

 repositories { ivy { url "C:/Users/RYAN/.ivy2/local" layout 'pattern', { artifact "[organisation]/[module]/[revision]/[artifact](-[classifier])-[revision](.[ext])" ivy "[organisation]/[module]/[revision]/[artifact](-[classifier])-[revision](.[ext])" } } 

But I do not want to indicate the absolute path. I see the GRADLE_USER_HOME environment variable there, but Gradle does not set it by default - I have to specify it on the command line.

Does Gradle provide a way to access Ivy's local repo by default?

+8
gradle ivy
source share
1 answer

How about using:

 url "${System.properties['user.home']}/.ivy2/local" 
+11
source share

All Articles