Can I download some files from http while maven lifecycle? any plugin?
相关问题
- HTML <form> tag causing Rails form to submit
- How to resolve Maven exec plugin: classpath too lo
- Maven: How to read the Parent POM version
- How can I send parameters for ASP.NET webservice
- Using AJAX to get a specific DOM Element (using Ja
相关文章
- C#中 public virtual string Category { get; }这么写会报错:
- Maven directory structure
- Passing the Maven Debug Flag from Hudson
- How to download image using rest template?
- Get size of Bitmap Android [duplicate]
- Getting number of fields in a database with an SQL
- Getting all items of QComboBox - PyQt4 (Python)
- Pre-fill Woocommerce checkout fields with Url vari
The maven-antrun-plugin is a more direct solution:
If available, wget can be used directly with exec-maven-plugin:
If the file is a Maven dependency, you could use the Maven Dependency Plugin which has a
get
goal.For any file, you could use the Antrun plugin to call Ant's Get task.
Another option would be the maven-download-plugin, it has been precisely created to facilitate this kind of things. It's not very actively developed and the documentation only mentions an
artifact
goal that does exactly the same thing asdependency:get
but.. If you look at the sources, you'll see that is has a WGet mojo that will do the job.Use it like this in any POM:
Key benefits of this plugin are caching of the download and checking against a signature, such as MD5.
Note that this answer has been heavily updated to reflect changes in the plugin as noted in the comments.
I'd like to add a few thing about the download-maven-plugin:
Seems like wagon-maven-plugin from CodeHaus allows to download files over HTTP (though this is not is original goal).
Here is an example downloading GlassFish zip before integration tests:
You can use the
download-single
goal in thewagon
plugin. Here is an example to download an HTML page (notice that the URL have to be split in a "directory" url and a "file name")