rerun-modules / nexus

Rerun module to manage the Sonatype Nexus Server
0 stars 1 forks source link

Add a command to put artifacts in the repository #1

Open ahonor opened 11 years ago

ahonor commented 11 years ago

The sonatype nexus API allows users to post files via curl like so:

curl -u user:user123 -F "r=releases" -F "g=group" -F "a=artifact" -F "v=version" -F "p=extension" -F "c=classifier" -F "e=extension" -F "file=@local-file;filename=filename" http://localhost:8081/nexus/service/local/artifact/maven/content

Proposal: Add nexus:post command. Here's the usage:

nexus:put: "Put an artifact in the repository" --file|-f <>: "file path" --repository|-r <>: "repository ID" --group|-g <>: "group ID" [--artifact|-a <>]: "artifact ID" --version|-v <>: "version" [--extension|-e <>]: "file extension" [--package|-p <>]: "artifact package type" [--classifier]: "artifact classification" [--url http://localhost:8081/nexus/service/local/artifact/maven/content]: "server url" [--user <>: "user name"] [--pasword <>: "password"]

Eg,

nexus:put --file myfile.zip -r releases -g rundeck-modules --version 1.0.0

ahonor commented 11 years ago

It would also be nice print a result after the artifact is posted. For example, it post the artifact, get the MD5 sum, and then compare it to the local file that was pushed.

jhulten commented 11 years ago

I have a ruby library I use that parses the SHA1 from the metadata and compares it to the local file. This would also be nice to have.

ashortland commented 11 years ago

Don't suppose anyone's made progress on this and just haven't pushed? I need the command for an example I'm putting together so will have a go myself, if not.

ahonor commented 11 years ago

It's all yours. :)

stagrlee commented 11 years ago

I had one written, but its locked up in a former employer's source. Worked great and got around all the awful bugs in maven's wagon.

ashortland commented 11 years ago

Found this article on the subject: https://support.sonatype.com/entries/22189106-How-can-I-programatically-upload-an-artifact-into-Nexus-

ashortland commented 11 years ago

Done this and it works just fine. Turns out Nexus has a very cleanly implemented REST API based on restlet.org.

Now there'll be a pause while I work out how to get approval to push it to the project!