注意:虽然这个问题涉及Artifactory API,但实际上更多的是编写半复杂的cURL命令。
说我在一个包含myapp-1.5.jar
的目录中。我们还说我在http://artrepo01:8080/artifactory/libs-release-local
有一个Artifactory仓库。
我想将JAR部署到:
libs-release-local/
myorg/
myapp/
1.5/
myapp-1.5.jar
根据Artifactory API docs(对于部署工件端点),正确的方法是通过HTTP PUT:
PUT /libs-release-local/my/jar/1.0/jar-1.0.jar
{
"uri": "http://artrepo01:8080/artifactory/libs-release-local",
"downloadUri": "http://artrepo01:8080/artifactory/libs-release-local",
"repo": "libs-release-local",
"path": "/myorg/myapp/1.5/myapp-1.5.jar",
"createdBy": "artadmin",
"mimeType": "application/java-archive",
}
问题:
curl -X PUT http://artrepo01:8080/artifactory/libs-release-local/myorg/myapp/1.5/myapp.jar
时(可能会或可能不正确,在哪种情况下不要担心上述问题),我从Artifactory收到错误,指出匿名用户对repo没有写入权限。我相信这是因为我的cURL命令没有指定createdBy
用户(artadmin
)。artadmin
用户的密码?答案 0 :(得分:1)
您的查询很好。只需使用-u
标志添加用户名和密码:
curl -X PUT -u artadmin:password http://artrepo01:8080/artifactory/libs-release-local/myorg/myapp/1.5/myapp-1.5.jar