Maven nexus v = LATEST not working

I have a local maven nexus repository, at runtime I load / extract the jar / war file from maven repo and copy it to tomcat. I use the following url to download the jar / war file.

http://localhost/maven/nexus/service/local/artifact/maven/redirect?r=releases&g=com.rdc.app&a=rum&v=LATEST&p=war&c 

When I go to v = 1.2.4, I can download a specific version of the war, if I need the latest version, I found that v = LATEST will return the latest version of the jar / war file to the repo.

The problem is the latest version in maven repo is 12.53.3, when I use v = LATEST, it loads 12.46.1 i to update 12.53.3 again and again tried v = LATEST, but the result was the same as before.

Also, if the last bank is SNAPSHOT different, then the jar / war v = LATEST release only supports the release version.

I tried the following documentation, but it seems that it does not work.

 repository.sonatype.org/nexus-core-documentation-plugin/core/docs/rest.artifact.maven.redirect.html 
+6
source share
3 answers

Sounds like metadata. Nexus has a scheduled task that can be used to restore the metadata of your repository.

+4
source

This is kind of a mistake if you ask me. I also came across this.

Basically, the LATEST version does not mean the “latest version”, as in 1.2.3 compared to 1.2.2, it means the “version of the artifact that was recently deployed”. So - if you have several project branches and artifacts are deployed by your continuous integration server, you cannot trust LATEST.

UPDATE: Check out the Tari aka Manga answer, for updated behavior on Nexus.

+6
source

Some have suggestions (for example: @carlspring) that “LATEST” does not really indicate the highest version available, given both releases and snapshots; they suggest that this is the most recently deployed, but I do not agree. This is what happens with the Sonatype Nexus ™ 2.11.2-0:

Intending 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) The publication of the new 1.0.2-SNAPSHOT only increases the time stamp "lastupdated", it does NOT change the "last".

Now published 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 the publication of the new 1.0.2-SNAPSHOT only increases the time stamp "lastupdated", it does NOT change the "last". In addition, publication 1.0.2 only increases the timestamp "lastupdated", it does not change the "last":

 <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 the younger one becomes later, the oldest published ones will win last place if it has a higher version. (A)

  • between the snapshot of the Vs release, the higher version wins the LAST place. (IN)

Consequently, the Sonatype Nexus ™ 2.11.2-0, “LATEST” indicates the highest version available, taking into account both releases and snapshots.

QED

+2
source

All Articles