Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

gradle

ivy

I'm migrating from Ant/Ivy to Gradle, and am trying to understand how you specify a relative path to the local Ivy repo. Standalone Ivy sets the variable ${ivy.default.ivy.user.dir} by default to .ivy2 in the user home directory, and places the local repo there.

I can simulate 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 don't want to specify an absolute path. I see there's a GRADLE_USER_HOME environment variable, but Gradle doesn't set it by default--I have to specify it command line.

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

like image 479
Ryan Nelson Avatar asked Apr 18 '12 23:04

Ryan Nelson


1 Answers

How about using:

url "${System.properties['user.home']}/.ivy2/local"
like image 55
vicsz Avatar answered Oct 17 '22 03:10

vicsz