Show compile dependencies only

(Mark Waschkowski) #1


I’m looking for a way to get just compile configuration dependencies from the command line. Barring that, can I do it with a task?

I tried both :

gradle dependencies compile


task showCompileDep << {

println configurations.compile.dependencies }

but just starting off, so not working…



(Peter Niederwieser) #2

Please use HTML ‘code’ tags for all code snippets.

task showCompileDep << {
   println configurations.compile

Or, probably more readable:

task showCompileDep << {
   configurations.compile.each { println it }

(Mark Waschkowski) #3

OK, sounds great, thanks. I’ll just use a special task. Would be nice to be able to do it from the command line, something like:

gradle dependencies.compile

Thanks again for the help!

(Peter Niederwieser) #4

I assume you are familiar with ‘gradle dependencies’.

(Mark Waschkowski) #5

Oh yes, was just thinking of a refinement to that functionality as the amount of text you get from that command is huge - being able to look at one configuration at a time would be very helpful.

(Szczepan Faber) #6

You can create an instance of dependencyReportTask:

task compileDeps(type: DependencyReportTask) {
  configurations = [project.configurations.compile] as Set

We’re looking at adding more command line support to the dependency report. There might be some new way of specifying a configuration in the dependency report in 1.3 or 1.4. Something like: ‘gradle dependencies --configuration compile’.

(Mark Waschkowski) #7

Thanks to everyone for the suggestions.

Thank you Szczepan, that is exactly what I was looking for. I also look forward to 1.3 or 1.4 for the functionality you mentioned.

Please consider this closed.