Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to upload JAR to Nexus OSS 3?

Tags:

nexus

nexus3

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.

like image 279
douglas.santos Avatar asked Jul 26 '16 15:07

douglas.santos


2 Answers

Contents of directory

cert_for_nexus.pem

curl.exe

pom.xml

utils-1.0.jar

Nexus v3 is configured for http

curl -v -u admin:admin123 --upload-file pom.xml http://localhost:8081/nexus/repository/maven-releases/org/foo/utils/1.0/utils-1.0.pom

curl -v -u admin:admin123 --upload-file utils-1.0.jar http://localhost:8081/nexus/repository/maven-releases/org/foo/utils/1.0/utils-1.0.jar

Nexus v3 is configured for https

  • prerequisite: must have curl with SSL enabled (link - left menu)

curl -v --cacert cert_for_nexus.pem -u admin:admin123 --upload-file pom.xml https://localhost:8443/nexus/repository/maven-releases/org/foo/utils/1.0/utils-1.0.pom

curl -v --cacert cert_for_nexus.pem -u admin:admin123 --upload-file utils-1.0.jar https://localhost:8443/nexus/repository/maven-releases/org/foo/utils/1.0/utils-1.0.jar

Contents of pom.xml

<project>
  <modelVersion>4.0.0</modelVersion>
  <groupId>org.foo</groupId>
  <artifactId>utils</artifactId>
  <version>1</version>
</project>

EDIT: fixed -u order for both https examples

like image 134
grajsek Avatar answered Sep 23 '22 19:09

grajsek


You could use nexus-cli.

docker run -ti -v $(pwd):$(pwd):ro sjeandeaux/nexus-cli:0.2.0 \
                          -repo=http://nexus:8081/repository/maven-releases \
                          -user=admin \
                          -password=admin123 \
                          -file=$(pwd)/upload.jar \
                          -groupID=your.group \
                          -artifactID=yourArtifactID \
                          -version=0.1.0 \
                          -hash md5 \
                          -hash sha1
like image 22
Stéphane Jeandeaux Avatar answered Sep 23 '22 19:09

Stéphane Jeandeaux