9

Using gradle dependencies I get a huge list of all dependencies. Showing all dependencies the projects I depend on have. Is it possible to limit the depth of the shown list?
Example:

+--- com.company.common:e-common-junit:0.29.0-SNAPSHOT
|    +--- junit:junit:4.11 (*)
|    \--- commons-io:commons-io:2.4
\--- org.slf4j:slf4j-log4j12:1.7.6
     +--- org.slf4j:slf4j-api:1.7.6
     \--- log4j:log4j:1.2.17

Limited to only +--- com.company.common:e-common-junit:0.29.0-SNAPSHOT
From the gradle site:

dependencies - Displays all dependencies declared in root project 'projectReports'.
api:dependencies - Displays all dependencies declared in project ':api'.
webapp:dependencies - Displays all dependencies declared in project ':webapp'.

It even mentiones that these reports can get large at this official source.
Stating that I should use --configuration, but as far as my understanding of this article goes it would only limit it to compile, testCompile and so on, not in depth.
Version in use gradle 2.11

Peter
  • 1,844
  • 2
  • 31
  • 55
  • 1
    There isn't a gradle way to filter dependency output, but you may be able to use grep to filter out what you don't want to see. – RaGe Oct 13 '16 at 20:05

1 Answers1

10

Use grep:

  • Show only top level dependencies:
    gradle dependencies --configuration compile | grep -v '| '

  • Show two levels:
    gradle dependencies --configuration compile | grep -v '| | '

etc

RaGe
  • 22,696
  • 11
  • 72
  • 104