Last active
October 20, 2024 11:40
-
-
Save matthiasbalke/3c9ecccbea1d460ee4c3fbc5843ede4a to your computer and use it in GitHub Desktop.
Gradle resolveDependencies Task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // found here: http://jdpgrailsdev.github.io/blog/2014/10/28/gradle_resolve_all_dependencies.html | |
| task resolveDependencies { | |
| doLast { | |
| project.rootProject.allprojects.each { subProject -> | |
| subProject.buildscript.configurations.each { configuration -> | |
| resolveConfiguration(configuration) | |
| } | |
| subProject.configurations.each { configuration -> | |
| resolveConfiguration(configuration) | |
| } | |
| } | |
| } | |
| } | |
| void resolveConfiguration(configuration) { | |
| if (isResolveableConfiguration(configuration)) { | |
| configuration.resolve() | |
| } | |
| } | |
| boolean isResolveableConfiguration(configuration) { | |
| def nonResolveableConfigurations = ['apiElements', 'implementation', | |
| 'runtimeElements', 'runtimeOnly', | |
| 'testImplementation', 'testRuntimeOnly', | |
| 'generatedImplementation', 'generatedRuntimeOnly'] | |
| if (nonResolveableConfigurations.contains(configuration.getName())) { | |
| return false | |
| } | |
| return true | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
FYI: a Kotlin version of the code snippet of @copitz: