I managed to make a little more progress on this tonight.
I was a bit thrown off by the namespace ivy:resovle in ant and the ivy.resolve gant so I expected it to be ivy.resolve in gradle also, but in gradle it is just simply resolve() on the ant builder.

I'd like to replace this logic with dependecies and upload tasks but I'm still struggling a bit trying to figure out how to get that working in gradle without the Java plugin. Copying dependencies seems reasonably straight forward with several examples in docs, but still struggling a bit using uploadTask and artifact config without the Java plugin.

I found an issue related to using ivy files from gradle:
http://jira.codehaus.org/browse/GRADLE-197. So I thought I would share my script for others that might be interested in using ivy.xml files directly. Could probably turn it into a plugin or something... but this is just a stepping stone to using native gradle stuff anyway and good enough for my needs at the moment.


-- project.gradle --
apply from: rootProject.file('ivy.gradle').toURI().

-- rootProject/buildSrc/ivy.gradle --

ant.project.log "Including Ivy build tasks"
initialize.dependsOn 'ivyRetrieve'
install.dependsOn 'ivyInstall'
deploy.dependsOn 'ivyDeploy'

ivySettings = rootProject.file('ivysettings.xml')
ivyCache = rootProject.file('ivyCache')

task initIvyProperties << {
        ant {
                taskdef( resource : 'org/apache/ivy/ant/antlib.xml')
                properties['ivy.settings.file'] = ivySettings
                properties['ivy.local.default.root'] = ivyCache
                properties['ivy.distrib.dir'] = 'bin'
properties['ivy.publish.src.artifacts.pattern'] = '${ivy.distrib.dir}/([culture]/)[artifact].[ext]' properties['ivy.retrieve.pattern'] = '${ivy.distrib.dir}/([culture]/)[artifact].[ext]' if(hasProperty('version') && version != '') properties['ivy.deliver.revision'] = version
        }
}

task ivyResolve(dependsOn: 'initIvyProperties') << {
        ant.resolve()
}
task ivyRetrieve(dependsOn: 'ivyResolve') << {
        ant.retrieve()
}
task ivyInstall(dependsOn: 'initIvyProperties') << {
ant.publish ( resolver : "local", forcedeliver: "true", overwrite: "true" )
}
task ivyDeploy(dependsOn: 'initIvyProperties') << {
        ant {
if(! ant.properties['ivy.deliver.revision']) fail( message: 'ivy.deliver.revision not specified') echo "Deploying revision ${ant.properties.'ivy.deliver.revision'} ${ant.properties.'ivy.status'}"
                publish ( resolver : "shared", forcedeliver: "true" )
        }
}



---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email


Reply via email to