Search code examples
restnexussonatype

Getting the version number (!) of the most recent release of an artifact


for a hubot script i need to determine the most recent release version of an artifact. All artifacts are deployed to a sonatype nexus, so i want to use the nexus api to do that.

Is there a way to get the nexus api to return just the version number?


Solution

  • as described here i can use the "resolve" function that returns all information about an artifact i could ever want

    For Example:

    https://oss.sonatype.org/service/local/artifact/maven/resolve?r=cometd-snapshots&g=org.cometd.jetty&a=cometd-jetty-client&v=1.0-SNAPSHOT&e=jar

    Note:

    • the type (e) is optional, the default value is jar
    • it is possible to get a json result, but in case of errors or non existing artifacts the result is ALWAYS html
    • the versions LATEST and RELEASE are supported