When Gradle tries to resolve a dependency with version containing “+” instead of taking the “latest” as specified by maven-matadata.xml, it seems to go by either “string comparison” on versions or modification date…
Example
Repository set to http://repo.spring.io/plugins-release/org/springframework/data/spring-data-mongodb/ Dependency is: compile group: ‘org.springframework.data’, name: ‘spring-data-mongodb’, version: ‘1.5.+’
At the time of posting repository maven-metadata.xml contained:
<?xml version="1.0" encoding="UTF-8"?>
<metadata>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-mongodb</artifactId>
<version>1.0.1.RELEASE</version>
<versioning>
<latest>1.5.0.RELEASE</latest>
<release>1.5.0.RELEASE</release>
<versions>
.....
</versioning>
</metadata>
Repository artifacts (latest ones) with last modififed date were:
1.5.0.M1/
09-Apr-2014 08:04 1.5.0.RC1/
21-May-2014 21:46 1.5.0.RELEASE/
20-May-2014 16:38
Expected Result_ Dependency resolved to “1.5.0.RELEASE”
Actual Result Dependency resolves to “1.5.0.RC1”
When Gradle resolves dependencies it takes “1.5.0.RC1” over “1.5.0.RELEASE” which is defined in maven-metadata.xml. By looking at Last Modified date above it would seem that it goes by this date, over metadata definition.