Thomas Kinnen wrote:
Ok,
I just found this nice line on the mailing list's archive:
configurations.runtime.resolve()
This basically replaces my function. Now I only need to know how to
filter projects and non projects.
Thomas Kinnen wrote:
Hi everyone,
I'm trying to retrieve a list of all dependencies my project has,
including those of subprojects. My goal is to collect all dependencies
and then collect all the corresponding jar files to copy them into a
single folder.
The best i have come up with until now is the following:
Set collectDependencies(proj) {
HashSet ret = new HashSet()
for(file in proj.configurations.compile) {
ret.add(file)
}
for(entry in proj.configurations.compile.getAllDependencies()) {
if(entry instanceof
org.gradle.api.internal.artifacts.dependencies.DefaultProjectDependency)
{
ret.addAll(collectDependencies(entry.dependencyProject))
}
}
return ret
}
Which will fill a java.util.Set with all the dependencies of a given
project. What i would like to do next is only include those
dependencies that are not projects. Currently i can't think of a
better when then to filter my collectedDependencies by path, keeping
only those in my library folder. This however removes some files that
should also be in the list, but which are not in the main library
folder, but in local project folders. Any better ideas would be very
appreciated.
Thomas
You can make a copy of the configuration with a filter by type like:
configurations.runtime.copyRecursive(DependencySpecs.type(Type.EXTERNAL))
See the ide task in the root build.gradle file in gradle itself for an example.
--
Steve Appling
Automated Logic Research Team
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email