Can I use / instead of . in organisation part of ivy layout pattern


(Dalibor Novak) #1

Hello,

I am writing a gradle script that interacts with an ivy repository. The repository uses following patterns to store ivy.xm files and artifacts:

ivy 'http://server.com/artifactory/repo/[organization]/[module]/[revision]/ivy-[revision].xml'
    artifact 'http://server.com/artifactory/repo/[organization]/[module]/[revision]/[type]s/[artifact]-[revision](-[classifier]).[ext]'

Where organization uses m2 style directory structure (eg. org/apache/commons). The problem I have is that if I try to use the ‘pattern’ layout my organization resolves using dots (e.g. org.apache.commons), but if I use the ‘maven’ layout I am not allowed to provide a custom artifacts pattern. In essence I would like to be able to do something like this:

repositories {
    ivy {
        url 'http://server.com/artifactory/repo/'
        layout 'maven', {
            artifact '[organization]/[module]/[revision]/[type]s/[artifact]-[revision](-[classifier]).[ext]'
        }
    }
}

This is obviously not possible as I get

Could not find method artifact() for arguments [[organization]/[module]/[revision]/[type]s/[artifact]-[revision](-[classifier]).[ext]]

But is there a workaround that would achieve that effect?

Thanks

Version information

------------------------------------------------------------
Gradle 1.2
------------------------------------------------------------
  Gradle build time: Wednesday, September 12, 2012 10:46:02 AM UTC
Groovy: 1.8.6
Ant: Apache Ant(TM) version 1.8.4 compiled on May 22 2012
Ivy: 2.2.0
JVM: 1.6.0_33 (Sun Microsystems Inc. 20.8-b03)
OS: Linux 2.6.34.8-68.fc13.x86_64 amd64

(Dalibor Novak) #2

Hello,

I’ve added support of such maven layout to ‘pattern’ layout and have sent you a [pull request] (https://github.com/gradle/gradle/pull/108) . Is there any chance this can make it into main codebase so I don’t have to maintain a separate one? There might be other folks with similar requirements that would benefit as well.

Cheers, Dali


(Peter Niederwieser) #3

+1 from my side; useful and easy to implement feature. I’ve had the need for it myself, and had to resort to an ugly workaround (direct use of Ivy resolver).


(Dalibor Novak) #4

Hi Peter,

I am glad you find the feature useful. Can you please let me know what is the process of taking it further?

Thanks, Dali