Gradle dependencies management with "+" sign

I am having a dependencies with version 1.2.+ but it goes for the following order.

Current available version 1.2.3 and 1.2.4-SNAPSHOT in the same repo.

It will look for the 1.2.4-SNAPSHOT and then download it.

  1. Is it possible to get the 1.2.3 using dynamic range instead of 1.2.4-SNAPSHOT??

In fact, when doing comparison, it will ignore all the classifier or string after “-”?

So is it impossible to mention the dynamic stable release without separating into the 2 repo?

You could use a ‘ComponentSelectionRule’ to get this behavior.

configurations.all {

resolutionStrategy {

componentSelection {

all { ComponentSelection selection ->

if (selection.candidate.version.contains(“SNAPSHOT”)) {

selection.reject(“Don’t use SNAPSHOT dependencies”)

}

}

}

}

}

Edit: You could also alternatively use the ‘latest.release’ version selector but it would additionally resolve to 1.3 if such a version existed, which may not be what you want.