Ivy issues in 1.3.6

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Ivy issues in 1.3.6

Oliver Wahlen
I am facing several ivy issues in grails-1.3.6.
I have to integrate some flex files from a maven repository into the grails application.
Since maven is broken in 1.3.6 (http://jira.codehaus.org/browse/GRAILS-7079) I was trying to do this with the "normal" BuildConfig.groovy options that operate on top of ivy.

In the dependencies section I do the following (after adding my repository):
runtime group: 'com.test', name: 'test-flex', version: '0.1-SNAPSHOT', transitive: false

This downloads test-flex.swf once. However the continuous updating of the SNAPSHOT does not work. This is a known bug that is supposed to be fixed in 1.3.6 but it does not work for me:
http://jira.codehaus.org/browse/GRAILS-5700

Furthermore the test-flex has several classifiers that I need to integrate, too.
These are modules (i.e. additional swf files) that test-flex.swf depends upon.

I have tried something like this:
runtime group: 'com.test', name: 'test-flex', version: '0.1-SNAPSHOT', classifier: 'dashboard', transitive: false
but it does not work.

To avoid others spending so much time on these issues I hereby present my workaround.
It would be nice if someone could tell me if there is a more elegant way to do this.
I am using maven-ant-task in BuildConfig.groovy to manually fetch everything I need from the maven repository:

grails.project.dependency.resolution = {
  ...
  dependencies {
    build group: 'org.apache.maven', name: 'maven-ant-tasks', version: '2.1.1', transitive: false
  }
  ...
}

grails.war.resources = { stagingDir, args ->
    // use maven ant task to fetch and deploy artifacts from elira maven repository
    taskdef(resource: 'org/apache/maven/artifact/ant/antlib.xml')
    remoteRepository(id: "remote.repository",url: "http://10.11.0.1:8081/nexus/content/repositories/snapshots/")
    // fetch and deploy the flex files
    dependencies(filesetId: "dependency.fileset", useScope: "runtime", versionsId: "dependency.versions") {
        dependency(groupId: 'com.test',artifactId: 'test-flex',version: '0.1-SNAPSHOT',type: 'swf')
        dependency(groupId: 'com.test',artifactId: 'test-flex',version: '0.1-SNAPSHOT',type: 'swf',classifier: 'dashboard')
        remoteRepository(refId: 'remote.repository')
    }

    // copy the files to the stage directory and remove any version information from the filename
    copy(todir: "${stagingDir}/test-flex") {
        fileset(refid: "dependency.fileset")
        mapper(classname: "org.apache.maven.artifact.ant.VersionMapper", from: "\${dependency.versions}", to: "flatten")
    }
}