Want to save latest timestamp and build number for jar

I have a bash script that is going to download the latest jar file from my repository. It gets the timestamp and build number from the maven-metadata.xml file. However the timestamp and build number listed in the xml file is for the latest version, which you can see in the picture below is “1.0-20190718.223642-4”, but this folder only has the .pom file, not the .jar! The version I want is the “1.0-20190718.223637-3” where the .jar is placed. Both of these folders are part of the same build which is uploaded to Nexus by Jenkins. Is there a way I can get the timestamp and build number for the folder containing the .jar file or maybe a way to reorder them so the .jar is in the folder with the latest timestamp?


Problem solved. It was simply a matter of changing the order of the artifacts in my Jenkinsfile which describes the pipeline process.

You may want to change your build so you have a consistent timestamp. I suspect downstream maven builds would also have difficulty consuming artifacts spread across timestamps.