Reputation: 29497
I have a (Gradle-built) project that produces a JAR at <projectRoot>/build/libs/myapp-<version>.jar
. I am now trying to write a curl
command that publishes that JAR to Artifactory like so:
curl -i -X PUT -u myuser:12345@$ -T "build/libs/myapp-0.1.20.jar" "http://artifactory.example.com/libs-release-local/com/me/myapp/myapp/0.1.20/myapp-0.1.20.jar"
When I run this in the console I get:
HTTP/1.1 100 Continue
HTTP/1.1 403 Forbidden
Server: Apache-Coyote/1.1
Content-Type: text/html;charset=utf-8
Content-Language: en
Content-Length: 961
Date: Mon, 01 Jun 2015 15:07:42 GMT
<html><head><title>Apache Tomcat/7.0.56 - Error report</title><style><!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}--></style> </head><body><h1>HTTP Status 403 - </h1><HR size="1" noshade="noshade"><p><b>type</b> Status report</p><p><b>message</b> <u></u></p><p><b>description</b> <u>Access to the specified resource has been forbidden.</u></p><HR size="1" noshade="noshade"><h3>Apache Tomcat/7.0.56</h3></body></html>
I have verified that myuser
is a valid Artifactory user with publish capabilities (especially for libs-release-local
) and that the password is correct. I am aware that there is an Artifactory-Gradle plugin, but for reasons outside the scope of this question I am not interested in it; I want to get this working using curl
.
Upvotes: 1
Views: 3781
Reputation: 20376
The 403 response you are getting is returned by Tomcat and not Artifactory.
You can determine this by looking at the Server header value which is Apache-Coyote/1.1
instead of Artifactory/3.8.0
and by the fact that the reponse context type is text/html
rather than application/json
(Artifactory uses JSON for REST API error message).
This usually indicates that you are using a wrong URL, probably missing the artifactory webapp context. For example, deploying to
http://localhost:8081/libs-release-local
instead of
http://localhost:8081/artifactory/libs-release-local
In the case the issue was related to Artifactory user permission, you should have a got an error message similar to
{
"errors" : [ {
"status" : 403,
"message" : "User myuser is not permitted to deploy 'com/me/myapp/myapp/0.1.20/myapp-0.1.20.jar' into 'libs-release-local:com/me/myapp/myapp/0.1.20/myapp-0.1.20.jar'."
} ]
}
Upvotes: 3