What is the difference between gradle and maven package type repository in artifactory?


(khouloud) #1

I’m trying to create a custom Artifactory repository to resolve dependencies in my gradle project, but I’m confused between gradle and maven repo: what repository key should I choose? And what is the real difference between a gradle repository and a maven repository?


(Carlo Luib-Finetti) #2

There is no such thing as a Gradle repository if you think in terms of Artifactory (and the like). If you think of your local Gradle installation and compare it with a local Maven, then you have a difference. Gradle uses it’s own Gradle cache, which is a completely different thing as the Maven local repository.

Your question using Artifactory: in our project we defined an URL for the Artifactory virtual repository: artifactoryUrl=https://artifactory2.xxxxx.de/artifactory/repos-uvdms in “gradle.properties”. This is where Gradle looks up for resolving dependencies. For uploading our own built artifacts we defined a separate upload url artifactoryUploadUrl=https://artifactory2.xxxxx.de/artifactory/.

Then, in “build.gradle” we have this:

repositories {
  maven {
     url artifactoryUrl
        credentials {
            username artifactoryUser
            password artifactoryPassword
        }
 }

}

Hope this helps.


(khouloud) #3

Thanks @carlo_lf, it seems that I was confusing between a repository and layout; in fact Artifactory offer the possibility to create a repository and choose Gradle or maven Layout and that’s what make me a little bit confused…