After I sent my reply I realised that you meant an API method to get the type. That would be preferable if there are dependencies for which the type does not equal the file extension, but I'm not sure if such dependencies exist.
I used getAllDependencies to include inherited dependencies (ie from parent configurations) and indeed, I wanted to omit project dependencies. The example skips client modules as well [an unintended side-effect :)]. Op 18 jul. 2010 om 18:27 heeft Paul Gier <[email protected]> het volgende geschreven: > Yes, that works nicely thanks very much! I guess there is no way to get > the file type from the api so you just have to parse the file name. > > What's the reason for using getAllDependencies(ExternalDependency)? > Does that exclude inter-module dependencies? > > On 07/18/2010 12:16 AM, Levi Hoogenberg wrote: >> Does the following script (which I tested with 0.9-preview-3) do what >> you want? (And how does it differ from your own solution? I wouldn't >> directly call it unelegant.) >> >> apply plugin: 'java' >> >> dependencies { >> compile group: 'org.slf4j', name: 'slf4j-api', version: '1.6.0' >> } >> >> task listDependencies << { >> configurations.compile.getAllDependencies(ExternalDependency).each >> {dependency -> >> configurations.compile.files(dependency).each {file -> >> println "${dependency.group}:${dependency.name >> <http://dependency.name>}:${file.name.split('\\.')[-1]} = >> ${file.canonicalPath}" >> } >> } >> } >> >> On Sun, Jul 18, 2010 at 6:39 AM, Paul Gier <[email protected] >> <mailto:[email protected]>> 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? >> >> Thanks! >> >> --------------------------------------------------------------------- >> To unsubscribe from this list, please visit: >> >> http://xircles.codehaus.org/manage_email >> >> >> > > > --------------------------------------------------------------------- > To unsubscribe from this list, please visit: > > http://xircles.codehaus.org/manage_email > > --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email
