On 18/07/10 2:39 PM, Paul Gier wrote:
I have a set of compile dependencies, and I would like to generate
properties that look like this:
group:name:type = /path/to/jar

For example a junit dependency would give something like
junit:junit:jar = /home/me/.gradle/junit/junit-4.3.jar

I'm able to get the dependency linked to the file using a combination of
configurations.compile.files and configurations.compile.dependencies but
it's not very elegant, and I can't figure out how to get the file type.
  Is there an easy way to do this?

Depends if you want to include a subset of the dependencies or not. If you want to simply include all the dependencies of a configuration (including the transitive dependencies), you can do something like:

configurations.compile.resolvedConfiguration.resolvedArtifacts.each { artifact ->
    println "group = ${artifact.resolvedDependency.moduleGroup}"
    println "name = ${artifact.resolvedDependency.moduleName}"
    println "type = ${artifact.type}"
    println "file = ${artifact.file}"
}

Have a look at ResolvedArtifact for the information that is available for the artifact: http://gradle.org/0.9-preview-3/docs/javadoc/org/gradle/api/artifacts/ResolvedArtifact.html

Things get quite a bit more awkward if you want to do any kind of filtering.


--
Adam Murdoch
Gradle Developer
http://www.gradle.org
CTO, Gradle Inc. - Gradle Training, Support, Consulting
http://www.gradle.biz


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

   http://xircles.codehaus.org/manage_email


Reply via email to