Learner
Learner

Reputation: 1313

How to constrain Gradle's "latest.integration" or "latest.release" to a range?

Still learning gradle here. Looking for a way to get either the latest "anything" (snapshot/integration or release) or latest must-be-release for a given range, say [1.0,2.0). Is there a way to specify that? Searched everywhere and only found references to either using ranges (which does not seem to allow me to restrict to releases or work with snapshots) or to always keep it entirely open using "latest.integration" and/or "latest.release".

Please help!

Upvotes: 2

Views: 1651

Answers (2)

Learner
Learner

Reputation: 1313

OK, I just updated to the newest Gradle 2.1. That resolved some issues I was having. Otherwise, I discovered the following:

"latest.integration" will match the latest anything - snapshot or release, whatever it finds newer.

"latest.release" will match the latest release and skip the snapshots.

"major.minor.+" (however many version number segments you have) will actually behave as "latest.integration" restricted to major.minor. Originally I thought it was restricted to releases but, no, it actually matches snapshots too.

"[1.0,2.0)" will actually behave list "latest.integration" within the range, too and will include snapshots, unlike I thought and commented above.

So, what I now don't know how to do is how to restrict a range or "1.+" to releases, but that is not my immediate problem (may be some hours from now, LOL).

UPDATE

One way to restrict versions to a range seems to be to mess with "Component metadata rules". Non-matching versions (those outside range) could be artificially declared non-releases. This is really ugly, though...

UPDATE 2

A part of my confusion was due to behavioural change between the old Gradle I was using and the new 2.1 one. Above is for 2.1 - old one I had (1.8) did NOT behave cleanly as per above.

Upvotes: 1

Peter Niederwieser
Peter Niederwieser

Reputation: 123960

[1.0,2.0) already means either "latest anything" or "latest must-be-release" (I think the latter, but not entirely sure). The other isn't currently supported.

Upvotes: 1

Related Questions