Ryan Nelson
Ryan Nelson

Reputation: 4666

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

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?

Upvotes: 10

Views: 5852

Answers (1)

vicsz
vicsz

Reputation: 9744

How about using:

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

Upvotes: 15

Related Questions