How to get latest release version in an Range?

Looks like there is a GRADLE-3097 which always get snapshots, Is there way by providing ranges , we can select if its a snapshot or release ?

latest.integration and latest.release does not help, because there might be changes were 2 branches diverge and they have to resolve dependencies .

There’s not an easy way to declare a dependency requirement that combines a version range with a SNAPSHOT dependency or a check for ivy status (release vs integration).

It’s possible you could build something using component metadata rules, where you use ‘latest.release’ as the dependency requirement, and maintain the required version range separately. You could then use a rule to force the status to be ‘integration’ for any version that doesn’t match the range. 

Thanks! I have been using

latest.integration

and

latest.release

but i have not setting any status,

Our repositories are Maven repositories, So my question is will latest.integration and latest.release work to get latest snapshot/release builds?

Also component metadata rules seems very interesting, Is there an example i can look which sets the status when uploading snapshot or releases and then it can be used in metadata rules so right build is selected.

Gradle considers every external module to have a ‘status’. For Ivy modules, this value is read from the ivy.xml. For Maven, SNAPSHOT modules have a status of ‘integration’, while other Maven modules have a status of 'release.

Component metadata rules apply at resolution-time, and can override the status that is determined for the module. You can read more about them here: http://www.gradle.org/docs/nightly/userguide/dependency_management.html#component_metadata_rules

If you can wait, we’re currently working on a mechanism that let’s you choose whether a particular module matches a version selector. This will let you hook in whatever logic you want. Expect to see something in the next month.