[GRADLE-3119] Dynamic version resolution does not consider the `latest` element of maven-metadata.xml Created: 02/Jul/14  Updated: 10/Feb/17  Resolved: 10/Feb/17

Status: Resolved
Project: Gradle
Affects Version/s: None
Fix Version/s: None

Type: Bug
Reporter: Gradle Forums Assignee: Unassigned
Resolution: Won't Fix Votes: 0

Issue Links:
Related
Related to GRADLE-2539 latest.release should consider the re... Resolved
Related to GRADLE-3384 Maven uploading is not updating 'late... Resolved

 Description   

When Gradle tries to resolve a dependency with version containing "+", it does not consider the the "latest" version as specified by maven-matadata.xml. Instead, Gradle uses the "versions" lists and uses the built-in version selection algorithm to choose the latest version.

_Example_
Repository set to [1]http://repo.spring.io/plugins-release...
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.
The built-in algorithm in Gradle has special handling for the "RC" suffix, implicitly considering these releases as newer than other releases with arbitrary suffixes. Gradle doesn't have any special handling for the "RELEASE" suffix.

----------------------------------------------------------------------------------------
[1] http://repo.spring.io/plugins-release/org/springframework/data/spring-data-mongodb/



 Comments   
Comment by Gradle Forums [ 02/Jul/14 ]

Just wondering If this is actually an proper behavior as for me it does sound a bit backwards...

Comment by Daz DeBoer [ 21/Feb/16 ]

Note: It's unclear as to whether this is really a bug. According to Mark's comment on GRADLE-3384, this element is only generated by Maven when publishing a Maven plugin, not when publishing a regular java library.

Comment by Benjamin Muschko [ 15/Nov/16 ]

As announced on the Gradle blog we are planning to completely migrate issues from JIRA to GitHub.

We intend to prioritize issues that are actionable and impactful while working more closely with the community. Many of our JIRA issues are inactionable or irrelevant. We would like to request your help to ensure we can appropriately prioritize JIRA issues you’ve contributed to.

Please confirm that you still advocate for your JIRA issue before December 10th, 2016 by:

  • Checking that your issues contain requisite context, impact, behaviors, and examples as described in our published guidelines.
  • Leave a comment on the JIRA issue or open a new GitHub issue confirming that the above is complete.

We look forward to collaborating with you more closely on GitHub. Thank you for your contribution to Gradle!

Comment by Benjamin Muschko [ 10/Feb/17 ]

Thanks again for reporting this issue. We haven't heard back from you after our inquiry from November 15th. We are closing this issue now. Please create an issue on GitHub if you still feel passionate about getting it resolved.

Generated at Wed Jun 30 12:40:30 CDT 2021 using Jira 8.4.2#804003-sha1:d21414fc212e3af190e92c2d2ac41299b89402cf.