Filtering dependencies by version numbers patterns

My build uses a semantic version number scheme, e.g.

1.1.1-beta1 < 1.1.1-beta2 < 1.1.1-rc1 < 1.1.1 < 1.1.2-beta1

and so on

Version numbers are generated by the build after a project passes some checks and the beta/rc qualifier is used to denote a certain level of maturity, e.g. pass unit test so create a new beta, pass performance test so create an rc etc.

In certain circumstances I want to only retrieve dependencies that have reached a certain level of maturity, so for example I want the latest rc from 1.1+. This is kind of like latest.release/latest.milestone in ivy terms but is probably, more specifically, a custom ‘LatestStrategy’.

Is this possible in gradle?

If so, how? and is it still possible if the backing store is a maven repository (sonatype nexus)?

Cheers Matt

Gradle does not provide a mechanism to handle versioning schemes other than the ivy default. We plan to provide a way to handle semantic versioning (as well as custom versioning schemes) in a future release.

For now, Gradle still uses the Ivy LatestStrategy under the covers. So if it is an option for you, it may be possible to fork Gradle and tweak the IvySettings object produced by ‘org.gradle.api.internal.artifacts.ivyservice.IvySettingsFactory’. Not much of a workaround, but I can’t think of a better way…

OK I thought you might say that. I use the gradle wrapper so it should be easy enough for me to fork and rebuild if I decide to go down this road.

I think a slightly simpler alternative for now is going to be publishing to a separate “beta” repository in nexus and only including that repository when a build decides it wants beta dependencies.

That’s the approach that SpringSource use, and they’ve had great success with it.