Nexus LATEST artifact version

1,729 views
Skip to first unread message

Derek J

unread,
Jul 20, 2015, 9:36:53 AM7/20/15
to nexus...@glists.sonatype.com
Hi

Does anyone know how Nexus determines the LATEST artifact version number?  Is it simply the highest numerical version number?

We're looking to use the REST API and specifically, queries from  /service/local/artifact/maven/resolve?g=<GROUP>&a=<ARTIFACT>&v=LATEST

Example

Some artifacts have a of 1.4, possibly used for a specific release in a specific environment and is quite a few months old.  This always gets reported as the LATEST version despite newer version being releases.

All the most incremental releases still use versions such as 1.1.50, then 1.1.51 etc

From a simple ascii or numerical sort, 1.4 would be the LATEST version but its actually 6 months old and what we really want when using the REST API to return the LATEST version is the most recent ( i.e. the 1.1.51 version )

You could argue that the version numbering has been done incorrectly and we have to remove the incorrect versions before this will work for us but can anyone confirm what the LATEST algorithm is?  Is it highest numerical sort/ASCII sort or something else?

Thanks

Derel




Ron Wheeler

unread,
Jul 20, 2015, 9:46:06 AM7/20/15
to nexus...@glists.sonatype.com
--
You received this message because you are subscribed to the Google Groups "Nexus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nexus-users...@glists.sonatype.com.
To post to this group, send email to nexus...@glists.sonatype.com.
To view this discussion on the web visit https://groups.google.com/a/glists.sonatype.com/d/msgid/nexus-users/a625a3ee-2e9d-45a2-8aba-3729e3c2f195%40glists.sonatype.com.
For more options, visit https://groups.google.com/a/glists.sonatype.com/d/optout.


-- 
Ron Wheeler
President
Artifact Software Inc
email: rwhe...@artifact-software.com
skype: ronaldmwheeler
phone: 866-970-2435, ext 102

Peter Lynch

unread,
Jul 20, 2015, 10:02:20 AM7/20/15
to nexus...@glists.sonatype.com

Derek Johnston

unread,
Jul 20, 2015, 10:07:37 AM7/20/15
to nexus...@glists.sonatype.com
Thanks - that helps.

I was starting to think we might have to program this ourselves and couldn't rely on LATEST so that seems to confirm it.

Its purely for reporting and monitoring so we just need a way of reporting the most recent release of an artifact.

Feels like it should be easy and we've got close with a Lucene repository search and/or storing system feed data but it still needs a little bit of development work.

Anyone else know of a quick way of doing this?

Regards

Derek

Ron Wheeler

unread,
Jul 20, 2015, 10:28:14 AM7/20/15
to nexus...@glists.sonatype.com
The article  that Peter references has an interesting thought that might help
"If you need the highest version of a released non-plugin artifact you should be using version ranges, see section 3.4.3"
This may help you get around Nexus and Maven including version 1.4 in dependency resolution.
You will have to test the API to see if it follows the same convention around version numbers."(,1.4)" - any version less than 1.4.

Fixing your versions by jumping from 1.1.51 to 1.5.0 or 2.0.0, the next time you release a new version is the long term solution.
It still leaves the 1.4 in place for people to use if they need it if you can not find out where it is used and fix the consuming projects.
It creates an awkward jump in the versioning system but gets you back on track.
 
Ron

Anders Hammar

unread,
Jul 20, 2015, 10:35:28 AM7/20/15
to nexus...@glists.sonatype.com
Just keep in mind that Maven ranges requires the version info in the maven-metadata.xml file to be correct. It does not check the versions of the actual existing artifacts.
 
/Anders

Peter Lynch

unread,
Jul 20, 2015, 4:09:26 PM7/20/15
to nexus...@glists.sonatype.com
On Mon, Jul 20, 2015 at 11:28 AM, Ron Wheeler <rwhe...@artifact-software.com> wrote:
The article  that Peter references has an interesting thought that might help
"If you need the highest version of a released non-plugin artifact you should be using version ranges, see section 3.4.3"
This may help you get around Nexus and Maven including version 1.4 in dependency resolution.
You will have to test the API to see if it follows the same convention around version numbers."(,1.4)" - any version less than 1.4.

Our API does not support version ranges. This is only applicable to Maven pom.xml files - and Maven is in charge of deciding the latest version based on published maven-metadata.xml content from all the repositories it accesses ( may not be just Nexus ). 

Ron Wheeler

unread,
Jul 20, 2015, 4:50:55 PM7/20/15
to nexus...@glists.sonatype.com
On 20/07/2015 4:09 PM, Peter Lynch wrote:


On Mon, Jul 20, 2015 at 11:28 AM, Ron Wheeler <rwhe...@artifact-software.com> wrote:
The article  that Peter references has an interesting thought that might help
"If you need the highest version of a released non-plugin artifact you should be using version ranges, see section 3.4.3"
This may help you get around Nexus and Maven including version 1.4 in dependency resolution.
You will have to test the API to see if it follows the same convention around version numbers."(,1.4)" - any version less than 1.4.

Our API does not support version ranges. This is only applicable to Maven pom.xml files - and Maven is in charge of deciding the latest version based on published maven-metadata.xml content from all the repositories it accesses ( may not be just Nexus ).

Too bad. I think that Nexus is the only repo in question, in his case.

Fixing the version progression issue is the easiest fix but not always easy to get people to buy in and it still leaves the 1.4 sticking out as a trap for the unwary.

Renaming the Artifact ID for the 1.4 version would be a cleaner way to fix it but then you have to find all the "where used" to get them to change.
Not too bad if all the users are internal but if the library is out in the public, someone is going to be unhappy one day.

Ron
Reply all
Reply to author
Forward
0 new messages