简体   繁体   English

通过REST API,POST将工件发布到Nexus

[英]Publish artifact to Nexus via REST API, POST

Not to savvy with Nexus administration.... 不要用Nexus管理精明......

Open a console to look at the network call when uploading an artifact "by hand". 在“手动”上传工件时打开控制台查看网络调用。 Want to skip using Maven or Ivy to upload to Nexus. 想要跳过使用Maven或Ivy上传到Nexus。 Everything query wise goes through ExtJS XHR calls except for the posting of artifact information which shows up in Chrome Developer Tools as a Documents call (assuming this is a form submit issued via ExtJS). 一切查询都通过ExtJS XHR调用,除了发布工件信息,这些信息在Chrome开发者工具中显示为文档调用(假设这是通过ExtJS发布的表单提交)。

Haven't tried simulating with curl (no idea how multipart forms are handled in curl if possible) but is this the only way to "post" artifacts besides doing a traditional publish from Ivy or Maven? 没有尝试使用curl进行模拟(如果可能的话,不知道如何在curl中处理多部分表单)但这是除了从Ivy或Maven进行传统发布之外“发布”工件的唯一方法吗? Looks like Nexus has a Java API but would like to remain in the REST HTTP world (hoping for Nexus REST service that basically does the multipart form post with something like apache's HTTPCLIENT). 看起来Nexus有一个Java API但希望保留在REST HTTP世界中(希望Nexus REST服务基本上可以使用apache的HTTPCLIENT等多部分表单发布)。

Use curl: 使用卷曲:

curl -v \
    -F "r=releases" \
    -F "g=com.acme.widgets" \
    -F "a=widget" \
    -F "v=0.1-1" \
    -F "p=tar.gz" \
    -F "file=@./widget-0.1-1.tar.gz" \
    -u myuser:mypassword \
    http://localhost:8081/nexus/service/local/artifact/maven/content

This will work with non-java dependencies for people not using maven. 对于不使用maven的人来说,这将适用于非java依赖项。 See my comments on this answer: https://stackoverflow.com/a/19699327/231573 . 请参阅我对此答案的评论: https//stackoverflow.com/a/19699327/231573

Found this response from Sonatype: 从Sonatype发现此回复:

In a nutshell, it's possible to POST the artifact directly, but what about the other files required for your Maven module? 简而言之,可以直接POST工件,但是Maven模块需要的其他文件呢? The most important being a POM... 最重要的是POM ......

The simplest way to upload a file is to use the deploy-file plugin: 上传文件的最简单方法是使用deploy-file插件:

Upload artifacts to Nexus, without Maven 将工件上传到Nexus,没有Maven

Is there a compelling reasons for not using the Maven client? 是否有令人信服的理由不使用Maven客户端?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM