Is the timestamp of Maven SNAPSHOTs of the same form in all repositories?

921 views Asked by At

We use Nexus 2, which assigns a timestamp to every SNAPSHOT jar. This timestamp can be used to address the specific jar.

We are thinking about moving to Nexus 3 or Artifactory in the future. I wonder whether the timestamp format is a Maven standard that is the same for all vendors.

1

There are 1 answers

0
carlspring On BEST ANSWER

This is not handled by Nexus, (or whatever the underlying artifact repository manager is), this is handled by Maven itself during deployment.

The timestamp is calculated per artifact deployment transaction (meaning for all the files belonging to the artifact (.pom, jar, .md5, .sha1 and/or whatever other files are produced). Maven generates the checksum and uploads all the artifact's files with the same timestamp. It then updates the maven-metadata.xml file, so that future requests by Maven(-like) clients could know what your 1.2.3-SNAPSHOT really translates to as a timestamp. Basically, before downloading an artifact, Maven downloads it's associated maven-metadata.xml file (if one exists).

So, to answer your question, this is not handled by the repository and upgrading to a newer version of Nexus should not impact this. (If it does, then it would be a bug).

For more details, you can check the maven-metadata tag on Stackoverflow, where I've added some explanations and a number of useful links.