Jay Taylor's notes
back to listing indexGradle tricks – display dependencies for all subprojects in multi-project build
[web search]About this blog
The blog about writing Clean Code, Software Craftsmanship, TDD, my tools, useful software and random tricks from a battlefield.
About me
Marcin Zajączkowski Solution Architect
Experienced architect aiming for high quality solutions. Very engaged in evangelising Software Craftsmanship, Clean Code and Test-Driven Development as a conference speaker and trainer. An expert in deployment automation with Continuous Delivery and Continuous Inspection of Code Quality. An enthusiast of Reactive Systems and broadly defined concurrency.Besides, open source author and contributor, a proud Linux user.
Living in Warsaw, Poland.
-
Recent Posts
- Convenient pushing new Git branch to remote repository – Git Tricks #3
- Easier work with Git submodules with in-place push access – Git Tricks #2
- Auto-switchable multiple Git identities on one computer – Git Tricks #1
- Reliable releasing to Maven Central from Travis using Gradle – 2019 edition
- Simplify integration testing of legacy application with Spock 1.2
Categories
- Concurrency (1)
- Good Code (7)
- Other (5)
- Tools (22)
- Tricks & Tips (32)
Top Posts & Pages
- Convenient mocking in Mockito with JUnit 5 - the official way
- Importance of given-when-then in unit tests and TDD
- Gradle tricks - display dependencies for all subprojects in multi-project build
- Using AssertJ and Awaitility together thanks to Java 8 and lambdas
- Gradle tricks - tracking down not expected transitive dependencies
Email Subscription
Enter your email address to subscribe to this blog and receive notifications of new posts by email.
Join 68 other followers
My projects
- 4developers announcement appfuse appinfo assertj awaitility bdd cd code-kata coding-dojo conference confitura continuous-delivery contribution craftsmanship dao database events failsafe feedback foss git git-tricks gradle gradle-pitest-plugin groovy hades happines-door hibernate idea integration tests Java java8 jpa junit kata lambda expressions maven maven-central mocking mockito mutation-testing my-tools news nexus pattern pit pitest polski poster presentation refcard release reportng solid spock spock-1.0 spock-1.1 spring spring-4.2 spring-boot springockito surefire tdd testing testng tests training trick tutorial util versioning warszawa-dp warszawa-jug wicket
Help improve my English
English is not my native language and I'm sure there are mistakes on my blog. If you notice any please let me know (via email or comments) to help improve my English and make my posts written better.
Blogroll
Gradle tricks – display dependencies for all subprojects in multi-project build
Posted: 2014-11-13 in Tricks & TipsTags: gradle, groovy, tutorial
gradle dependencies
allows to display dependencies in your project printed as pretty ascii tree. Unfortunately it does not work well for submodules in multi-project build. I was not able to find satisfactory solution on the web, so after worked out my own that blog post arose.
Multiple subprojects
For multi-project builds gradle dependencies
called in the root directory unexpectedly displays no dependencies:
-
If gradle is configured to run tasks in parallel, this wil make the output useless, because it interweaves output from the different subprojects.
I added this to solve it:
“`
// Create a chain of dependencies between all sub project’s “allDeps” tasks, so that the output is linear
// even when we run gradle in default “–parallel” mode.
def allSubProjects = subprojects as List
for (def index = 1; index < allSubProjects.size; ++index) {
allSubProjects[index].tasks.allDeps.dependsOn allSubProjects[index – 1].tasks.allDeps
}
“`-
Thanks for sharing. That in fact could be some problem, but for most of the projects I worked with it was doable to just wait a little bit longer executing just that one task. However then, you need to remember to disable the parallel mode :).
Btw, what Gradle version do you use? I believe in one of the Gradle versions released this year I have seen an improvement which was sorting out the console output in the parallel mode. Therefore, maybe it is already fixed out-of-box in 4.10?
Leave a Reply
-