简体   繁体   English

使用 curl 命令将多个文件上传到 Nexus

[英]uploading multiple files to Nexus using curl commands

I'm currently working on getting a script to upload my artifacts to Nexus using CURL.我目前正在使用 CURL 获取脚本以将我的工件上传到 Nexus。

I can get it to work with one artifact file without any problems using the command:我可以使用以下命令使其与一个工件文件一起使用而不会出现任何问题:

curl -v -F r={repo_id} -F hasPom=true -F e=jar -F file=@pom.xml -F file=@target/project.jar -u un:pwd {repo_url}

My project has both a jar containing the binaries and a jar containing the sources though.我的项目有一个包含二进制文件的 jar 和一个包含源代码的 jar。 I would like to deploy both to the same location in my maven repo.我想将两者都部署到我的 Maven 仓库中的相同位置。 I tried this with the curl command by adding a second file,我通过添加第二个文件用 curl 命令尝试了这个,

curl -v -F r={repo_id} -F hasPom=true -F e=jar -F file=@pom.xml -F file=@target/project.jar -F file=@target/project-sources.jar -u un:pwd {repo_url}

This essentially performs two seperate rest calls for each file, using the same pom.这基本上使用相同的 pom 为每个文件执行两个单独的休息调用。 Which doesn't work since my Nexus doesn't allow updating artifacts.这不起作用,因为我的 Nexus 不允许更新工件。

Is there a way to make this work, or can this only work by enabling the updating of artifacts?有没有办法让这个工作,或者这只能通过启用工件更新来工作? I would prefer not to enable this for obvious reasons.出于显而易见的原因,我不想启用此功能。

只需将-Dsources=${YourSourceJar}添加到您的 curl 命令。

I know this is an old issue, but I wanna add this.我知道这是一个老问题,但我想添加这个。

I've run into the same issues/problems during the past days.在过去的几天里,我遇到了同样的问题/问题。 To be honest, I couldn't find a solution to upload multiple jars with same pom.xml through curl.老实说,我找不到通过 curl 上传具有相同 pom.xml 的多个 jar 的解决方案。 I ended up using maven deploy-plugin.我最终使用了 maven deploy-plugin。 Please see my solution here .在此处查看我的解决方案。

Note: If you want to upload jars with multiple classifiers without the pom.xml - this can be achieved through the rest api.注意:如果你想在没有 pom.xml 的情况下上传带有多个分类器的 jars - 这可以通过 rest api 来实现。

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

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