On 26/09/2011, at 4:28 PM, Carlton Brown wrote: > I'm an Ivy user doing some exploratory testing to evaluate Gradle. I just > want to see dependency resolution/retrieval in action, nothing else right > now. After I've defined a dependency and a resolver in my build.gradle, > what command do I issue to cause a resolve to occur? Following that, what > do I need to do to cause an artifact retrieve to occur?
Gradle uses the concept of a “configuration” to contain dependencies. http://gradle.org/current/docs/javadoc/org/gradle/api/artifacts/Configuration.html You'll see that a Configuration is a FileCollection, which is a Gradle type for bunch of files. So the easiest way to do a resolve is to ask the FileCollection for its File objects <http://gradle.org/current/docs/javadoc/org/gradle/api/file/FileCollection.html#getFiles()> Here's a script you could use: apply plugin: "java" repositories { mavenCentral() } dependencies { compile 'commons-lang:commons-lang:2.6' } task doTestResolve << { configurations.compile.files.each { println "resolved dependency: $it" } } task doTestRetrieve(type: Copy) { from configurations.compile into "myDependencies" eachFile { println "retrieving dependency: $it.name" } } Depending on what you were trying to achieve, you might do some things slightly differently there in a real world scenario but they are minor things and aren't important if you just want to play with dependency management. > Apologies if I'm expressing this too much in Ant/Ivy terminology, but that's > the context I'm coming from. Please feel free to correct my perspective. I'm not sure my understanding of the terms with Ivy is correct so what's above may not map to what you had in mind. In Gradle, you simply declares what dependencies need to be part of a configuration and when those files are requested Gradle will make them available (or die trying). -- Luke Daley Principal Engineer, Gradleware http://gradleware.com --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email
