Maven nexus v=LATEST not working

This is sort of a bug, if you ask me. I have faced it as well.

Basically, LATEST version doesn't mean "latest version" as is in 1.2.3 compared to 1.2.2, it means "the version of the artifact which was most recently deployed". So -- if you have more than one branch of the project and the artifacts are being deployed by your continuous integration server, you can't trust LATEST.

UPDATE: Check Tari aka Manga's reply, for an updated behavior in Nexus.


This question and answer is now 6 years old. Please note that sonatype has a new version of Nexus with a revised backend.

Here is the updated link the the documentation on scheduled tasks, one of which is "Rebuild Maven Metadata Files":

  • Managing scheduled tasks

Original answer

Sounds like a meta data problem. Nexus has a scheduled task which can be used to rebuild your repository's metadata.


Some have suggestes (e.g.: @carlspring) that "LATEST" actually does not point to the highest version available, considering both releases and snaphots; they suggest is the most-recently deployed, but I disagree. This is what happens with Sonatype Nexus™ 2.11.2-0:

Assuming to start with:

<metadata modelVersion="1.1.0">
    <groupId>com.acme</groupId>
    <artifactId>versioningtest</artifactId>
    <versioning>
        <latest>1.0.3-SNAPSHOT</latest>
        <release>1.0.1</release>
        <versions>
            <version>1.0.0-SNAPSHOT</version>
            <version>1.0.0</version>
            <version>1.0.1-SNAPSHOT</version>
            <version>1.0.1</version>
            <version>1.0.2-SNAPSHOT</version>
            <version>1.0.3-SNAPSHOT</version>
        </versions>
        <lastUpdated>20150928081006</lastUpdated>
    </versioning>
</metadata>

(A) Publishing a new 1.0.2-SNAPSHOT only increments the "lastupdated" timestamp, it does NOT change the "latest".

Now publishing 1.0.3:

<metadata>
    <groupId>com.acme</groupId>
    <artifactId>versioningtest</artifactId>
    <versioning>
        <latest>1.0.3</latest>
        <release>1.0.3</release>
        <versions>
            <version>1.0.0-SNAPSHOT</version>
            <version>1.0.0</version>
            <version>1.0.1-SNAPSHOT</version>
            <version>1.0.1</version>
            <version>1.0.2-SNAPSHOT</version>
            <version>1.0.3-SNAPSHOT</version>
            <version>1.0.3</version>
        </versions>
        <lastUpdated>20150928081408</lastUpdated>
    </versioning>
</metadata>

(B) From here, publishing a new 1.0.2-SNAPSHOT only increments the "lastupdated" timestamp, it does NOT change the "latest". Also, publishing 1.0.2 only increments the "lastupdated" timestamp, it does NOT change the "latest":

<metadata>
    <groupId>com.acme</groupId>
    <artifactId>versioningtest</artifactId>
    <versioning>
        <latest>1.0.3</latest>
        <release>1.0.3</release>
        <versions>
            <version>1.0.0-SNAPSHOT</version>
            <version>1.0.0</version>
            <version>1.0.1-SNAPSHOT</version>
            <version>1.0.1</version>
            <version>1.0.2-SNAPSHOT</version>
            <version>1.0.2</version>
            <version>1.0.3-SNAPSHOT</version>
            <version>1.0.3</version>
        </versions>
        <lastUpdated>20150928081620</lastUpdated>
    </versioning>
</metadata>

So in conclusion:

  • between two snapshots, even if a younger comes being more recent, the oldest published would win the LATEST spot if it has a higher version. (A)

  • between release Vs snapshot, the higher version win the LATEST spot. (B)

Hence, Sonatype Nexus™ 2.11.2-0, "LATEST" point to the highest version available, considering both releases and snaphots.

Q.E.D.