When the above error occurred, i checked the path where the jar was to be uploaded and i noticed that the directory, jar and the maven-metadata.xml file were all created and the maven-metadata.xml had correct content in it. Still, i was getting the above error. So i was confused about the failure message.
The user (external) who was trying to upload was granted Deploy, Annotate and Read permission for a specific repository (libs-snapshot-local) with the following Include Pattern: **/*-SNAPSHOT/**
To investigate, I then replaced the 'external' user with 'admin' user in ~/.m2/settings.xml for connecting to Artifactory server for deploying artifact. This time, the command worked fine without any issue and a new snapshot version was uploaded in the same path and the build was successful. This was confusing.
I then reverted the user to 'external' user in ~/.m2/settings.xml. I also replaced **/*-SNAPSHOT/** with just ** in Include Pattern in Permissions section. Now when i ran the deploy command, it went fine without any issue.
These observations compel me to think that if it was indeed a permission issue (when Include Pattern was **/*-SNAPSHOT/**) for uploading com.abc:cpmsBase/maven-metadata.xml, then how come the file got created (refer attachment) with proper content? No file should have got created. Is this a bug?