Search code examples
nexusnexus3

how to upload JAR to Nexus OSS 3?


How to perform an upload of a jar via curl the Nexus 3? I tried using the link tips but without success.

Here are my attempts:

curl -v -F r = -F releases hasPom = true and = -F jar -F file = @. / v12.1.0.1 / pom.xml -F file = @. / v12.1.0.1 / ojdbc7.jar -u admin: admin123 http: // localhost: 8081 / repository / maven releases

curl -v -F r = -F releases hasPom = false -F and -F jar = g = com.oracle.jdbc -F = ojdbc7 -F v = 1.0 p = -F jar -F file = @. / v12 .1.0.1 / ojdbc7.jar -u admin: admin123 http: // localhost: 8081 / repository / maven releases

Both have 400 Bad Request.


Solution

  • I've modified your code as below. Please try this.

    curl -v -F r=releases -F hasPom=false -F e=jar -F g=com.oracle.jdbc -F a=ojdbc7 -F v=1.0 -F p=jar -F file=@"./v12.1.0.1/ojdbc7.jar" -u admin:admin123 http://localhost:8081/nexus/service/local/artifact/maven/content
    

    Also I would suggest using the full path rather than relative path. Can you share where you are using this curl snippet? Any CI tool like Jenkins?