I'm trying to download a single jar file from the maven repository, from the URL below.
http://repo1.maven.org/maven2/com/google/guava/guava-testlib/10.0/guava-testlib-10.0.jar
Downloading in a browser works fine, and I get the file as expected.
'wget' downloads something, but the file I get doesn't appear to be valid. Running 'jar -tf' on the downloaded file gives 'ZipException: error in opening zip file'.
Downloading the file programmatically from Java ('InputStream' from the URL writing to a 'FileOutputStream') downloads something and creates the file. Opening that with WinZip/7-Zip, it appears to contain one file named 'guava-testlib-10.0', which looks like the jar archive I was expecting to get.
wget
another jar does work as expected at least sometimes (with -U
user agent string)
Is this some dodgy interaction between wget/maven or Java/maven? Is it a malformed jar file that my browser understands and downloads correctly? Both of those seem slightly implausible to me.
Download Jar From maven.org. There is another maven repository that you can download jar files from. Open a web browser and browse the URL maven.org or search.maven.org. Input the jar library group name or artifact name in the search box, it will list all matched jar libraries.
Downloading a file In order to download a file using Wget, type wget followed by the URL of the file that you wish to download. Wget will download the file in the given URL and save it in the current directory.
wget generally gets blocked from the central maven repo because some people don't play nice and try to wget too much. Try set the user agent:
wget -U "Any User Agent" http://repo1.maven.org/maven2/com/google/guava/guava-testlib/10.0/guava-testlib-10.0.jar
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With