1
votes

Referring the guide below, I'm trying to upload library files to a maven repository on Artifactory; however, I'm having an error.

https://www.jfrog.com/confluence/display/RTF/Artifactory+REST+API#ArtifactoryRESTAPI-DeployArtifactsfromArchive

We've installed Artifactory on premise Linux server, and created a maven repository to store libraries for Java app build. It's prepared because our environment does not allow access to public internet and jcenter. We're planning to configure build job with maven on Jenkins which takes all the necessary libraries from the Artifactory repository.

The library files are given by development team. It follows maven structure because it's exported from Maven on local development PC.

I zipped the files, placed on the server and hit the below code.

curl -u user:password -X PUT http://[artifactory URL]/../[repository name] /tmp/src/archive.zip

Expected successful files upload to the repository. However, I've got the below error.

{"errors" : [ {
     "status" : 403,
     "message" : ""
 }]
}curl: (3) <url> malformed
2

2 Answers

1
votes

I zipped the files, placed on the server and hit the below code.

curl -u user:password -X PUT http://[artifactory URL]/../[repository name] /tmp/src/archive.zip

A few issues here:

  • As the error suggests, your URL is malformed. There should not be a /../. Just http://[artifactory URL]/[repository name] should be fine.
  • You're giving curl two bare paths, which it interprets as two URLs that it should PUT to. It's clear that this isn't your intent; the second path is the file you want to upload. You need to specify that by preceding it with, say, a -T.
  • This call will just upload the zip file into the root of your repository, but you want it to instead extract the contents. As stated by the documentation you linked, this can be done if you pass a header X-Explode-Archive: true or X-Explode-Archive-Atomic: true.

So your call should be something like:

curl -u user:password -X PUT http://[artifactory URL]/[repository name] -T /tmp/src/archive.zip -H 'X-Explode-Archive: true'
1
votes

I figured out the cause. The reason was because our version is not Artifactory Pro.

I was told it's pro but confirmed the actually installed SW is OSS version.