Artifactory's user's permissions not respected

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Artifactory's user's permissions not respected

Technext
d:\maven\maven-example\cpmsBase>mvn -v
Apache Maven 3.3.3 (7994120775791599e205a5524ec3e0dfe41d4a06; 2015-04-22T17:27:37+05:30)
Maven home: C:\apache-maven-3.3.3\bin\..
Java version: 1.7.0_67, vendor: Oracle Corporation
Java home: C:\Program Files\Java\jdk1.7.0_67\jre
Default locale: en_IN, platform encoding: Cp1252
OS name: "windows 7", version: "6.1", arch: "amd64", family: "windows"

Issue: I was trying to upload a jar to Artifactory via command line (mvn deploy -DskipTests) but it was throwing the following error:

Uploaded: http://server.development.com:8080/libs-snapshot-local/com/abc/cpmsBase/1.0-SNAPSHOT/maven-metadata.xml (
764 B at 2.7 KB/sec)
Uploading: http://server.development.com:8080/libs-snapshot-local/com/abc/cpmsBase/maven-metadata.xml
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.859 s
[INFO] Finished at: 2015-07-05T19:16:10+05:30
[INFO] Final Memory: 14M/219M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project cpmsBase: Failed to deploy metadata: Could not transfer metadata com.abc:cpmsBase/maven-metadata.xml from/to server.development.com (http://server.development.com:8080/libs-snapshot-local): Access denied to: http://server.development.com:8080/libs-snapshot-local/com/abc/cpmsBase/maven-metadata.xml, ReasonPhrase: Forbidden. -> [Help 1]
[ERROR]

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?