Last active
December 30, 2017 16:50
-
-
Save dudadornelles/be0bea9f98d3aa17404c to your computer and use it in GitHub Desktop.
Gradle - get resolved version of a dependency
This file contains 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
def getResolvedVersionOf(dependency) { | |
return configurations.compile.resolvedConfiguration.firstLevelModuleDependencies.asList().collectAll { e -> | |
if (e.moduleName == dependency) { | |
return e | |
} | |
}[0].moduleVersion | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I trimmed it down a bit by using
findAll()
: