Search code examples
maventimestampnexussnapshot

Get timestamp of deployed snapshot by Maven Deploy Plugin to Nexus


How to get timestamp of deployed snapshot by Maven Deploy Plugin to Nexus?

For example, I deployed an artifact with the version 1.2.3-SNAPSHOT which was deployed with the timestamp (I assume Nexus created this timestamp or at least the last "build number" part of it -23) 20210829.151247-23 (the format YYYYMMDD.HHMMSS-NNN). Can I get that timestamp by:

  • Some Maven command/s?
  • Some Nexus REST API?
  • Other "programmatic" way?

So far I found only an annoying :) workaround - "right after" I deployed the artifact to Nexus (because "right after" there is a "high chance" that nobody else in that "short time" replaced my deployed snapshot with his/her snapshot), I ran the goal dependency:copy of Maven Dependency Plugin with the property outputAbsoluteArtifactFilename=true to download "currently latest" snapshot from Nexus, thus "most probably" the snapshot I deployed, with the timestamp in its filename. The "annoying" part of that workaround solution is that I have to download the artifact (could have more than 100 MB) to find out the timestamp. Isn't there just some "peek" Maven command/option to get this timestamp without downloading any file?


Solution

  • As khmarbaise suggested, I used https://github.com/khmarbaise/deployment-recorder-extension/.