carlo_lf
(Carlo Luib-Finetti)
June 3, 2014, 1:20pm
1
Given a dependency declaration like this:
ext.libraries = [
commons_beanutils : 'commons-beanutils:commons-beanutils:1.9.+',
(...)
]
is there a way to get the Jar file name of this dependency for use at some other place, where I have to write an Eclipse config.ini like this:
/reference\:file\:commons-beanutils-1.9.2.jar/,
so that I do not have to hard code the version number here?
You’ll need a configuration to resolve the dependency from. Then you should be able to use something like ‘config.resolvedConfiguration.getFiles(“commons-beanutils:commons-beanutils:1.9.+”)’, although I haven’t checked if this also works for dynamic dependencies.
carlo_lf
(Carlo Luib-Finetti)
June 5, 2014, 8:33am
3
Hi Peter,
getFiles expects a parameter argument with type “Spec<? super Dependency>”. So, how can I get such an object having just a string?
Try something like ‘{ it.group == “commons-beanutils” && it.name == “commons-beanutils” && it.version.startsWith(“1.9”) } as Spec’.
carlo_lf
(Carlo Luib-Finetti)
June 11, 2014, 9:03am
5
Thanks, Peter, this works. The only thing I had to do is to filter out recursive dependencies which are listed as well.