Reputation: 668
In one of my app service, I need to access to some of the dependencies version I got compile, but I cannot find a way to access to the dependencies at runtime.
BuildConfig.groovy
dependencies {
runtime 'com.oracle:ojdbc14:10.2.0.2.0'
runtime 'com.google.guava:guava:11.0.1'
runtime 'com.thoughtworks.xstream:xstream:1.2.2'
runtime 'org.apache.httpcomponents:httpcore:4.3.1'
}
I need to access any dependecies version... Any ideas?
Upvotes: 2
Views: 46
Reputation: 42184
There is a way to get runtime dependencies, although it will return you all runtime dependencies, including those that were not explicitly defined by you.
BuildSettingsHolder.getSettings().runtimeDependencies.collect { it.name }
This will return you a list of names of all runtime dependencies, e.g.:
You can find dependencies you are interested in and extract their versions from String. I hope it helps you solving your problem.
Upvotes: 1