'Artifactory gradle plugin customize final artifact path

I am struggling to understand how I can use the gradle artifactory plugin to define a custom folder structure on artifact upload in JFrog.

To explain better let me use the following example. Suppose we have a maven repository called sports, suppose we have a project called football-1.0.0, where the compilation of this project produces a jar. Currently when I execute

gradle artifactoryPublish

I end up with the following folder structure in JFrog's artifactory.

sports
  football/1.0.0
    football.jar

However, what I would like to achieve would be something like this:

sports
  football
    1.0.0
      football.jar
    2.0.0
      football.jar
      

Respectively, uploading version 2.0.0 would create a new folder etc, etc. I am not sure how I can achieve this and a little hint / help would be appreciated. The artifactory plugin configuration that I currently have looks like this :

artifactory {
contextUrl = "https://some.jfrog.repository/artifactory"
publish {
    repository {
        repoKey = 'sports'
        username = project.getProperty("username")
        password = project.getProperty("password")
        maven = true

    }

    defaults {
        publications('mavenJava')
        publishPom = true
    }
}
resolve {
    repository {
        repoKey = maven
        username = project.getProperty("username")
        password = project.getProperty("password")
        maven = true

    }
}

}

NOTE : I tried playing with the repoKey in the both resolve and publish sections, but I could not achieve what I was looking for



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source