In our organization, we have extra properties in ivy file, which will be read and applied during dependency resolution, use the ivy FileSystemResolver:
But hence FileSystemResolver will be removed since gradle 2.0, what would be the alternative to achieve this: read the extra properties and apply it during dependency resolution.
OK but does your build file have access to the extra property values? The Gradle API doesn’t give you access to this information in your build, so I’m wondering how you use it.
Can you be a bit more specific about your actual use case for extra attributes?
Nope, I think I understand how you’re currently using Ivy extra attributes. They aren’t being used in dependency resolution, but recorded by the FileResolver and used elsewhere.
There’s a (not particularly nice) solution that doesn’t use require the use of (deprecated) FileResolver: download the ivy.xml file from the repository and parse it to extract the extra attribute data you require. You can download the ivy.xml file for a module with:
configurations {
ivyModules } dependencies {
ivyModules(‘org.gradle.sample:quickstart:1.0’) {
artifact {
name = “ivy”
extension = “xml”
type = “xml”
}
} }
While it’s unlikely that Ivy extra attributes will be supported directly in the Gradle model, it’s possible that a new hook will be added that will allow you to access the raw metadata file during resolution. I can imagine this being useful for extracting custom information from pom files, ivy files and whatever new metadata formats we support.