java 如何从远程 URL 卷曲 JAR
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/30195670/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to cURL a JAR from remote URL
提问by smeeb
I have a JAR that is available for download from an HTTP URL, say, http://somerepo.example.org/myjar-1.0.jar
.
我有一个可从 HTTP URL 下载的 JAR,例如http://somerepo.example.org/myjar-1.0.jar
.
I need a cURL command that will download it to the current directory; my best attempt thus far is:
我需要一个将它下载到当前目录的 cURL 命令;到目前为止,我最好的尝试是:
curl -i -H "Accept: application/zip" -H "Content-Type: application/zip" -X GET http://somerepo.example.org/myjar-1.0.jar
When I run this my console fills with binary spam and seems to cause my entire terminal to have a melt down.
当我运行它时,我的控制台充满了二进制垃圾邮件,似乎导致我的整个终端崩溃。
What is the correct cURL command to GET a JAR from a remote URL?
从远程 URL 获取 JAR 的正确 cURL 命令是什么?
回答by Martin Konecny
You are almost there. By default cURL will output the download to STDOUT. You want to redirect this to a file like so:
你快到了。默认情况下,cURL 会将下载输出到 STDOUT。您想将其重定向到一个文件,如下所示:
curl -H "Accept: application/zip" http://somerepo.example.org/myjar-1.0.jar > myfile.jar
You can also use the -o
option:
您还可以使用该-o
选项:
curl -H "Accept: application/zip" http://somerepo.example.org/myjar-1.0.jar -o myfile.jar
You should also be able to use wget
您还应该能够使用 wget
wget http://somerepo.example.org/myjar-1.0.jar