On May 13, 2008, at 10:34 AM, Hans Dockter wrote:
On May 12, 2008, at 3:15 PM, gradlefan wrote:
Hey,
I'm trying to write a plugin for my own purposes. For this to work
I need
get the actual file system path of JAR files represented by a
Dependency
object.
I can't find any obvious method in the JavaDoc.
There is no obvious method right now. We want to make the resolve
API richer in our future releases.
If you don't mind getting into the guts of our dependency handling
you could do the following:
import org.gradle.api.tasks.util.FileSetimport
org.apache.ivy.core.resolve.ResolveOptions
... some declarations
init.doLast() { dependencies.dependencies.each { def
resolveOptions = new ResolveOptions() def resolveReport =
dependencies.ivy.resolve(it.createDepencencyDescriptor
().dependencyRevisionId, resolveOptions, false)
println resolveReport.dependencies }}
The same again with new lines:
import org.gradle.api.tasks.util.FileSet
import org.apache.ivy.core.resolve.ResolveOptions
init.doLast() {
dependencies.dependencies.each {
def resolveOptions = new ResolveOptions()
def resolveReport = dependencies.ivy.resolve
(it.createDepencencyDescriptor().dependencyRevisionId,
resolveOptions, false)
println resolveReport.dependencies
}
}
As part of the init task we resolve every single dependency and
print out all of its dependencies. ResolveOptions and ResolveReport
are Ivy classes. You might look in the Ivy JavaDoc or Ivy code for
further details.
Such things should become more convenient in the future.
- Hans
Please advise.
Thanks
--
View this message in context: http://www.nabble.com/How-to-get-the-
path-of-a-JAR-based-on-a-Dependency-object--tp17187322p17187322.html
Sent from the gradle-user mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email
--
Hans Dockter
Gradle Project lead
http://www.gradle.org
--
Hans Dockter
Gradle Project lead
http://www.gradle.org