I am 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 the browser works fine, and I get the file as expected.
'wget' is loading something, but the file I get is not valid. Running "jar -tf" in the downloaded file gives "ZipException: error opening zip file."
Downloading the file programmatically from Java (“InputStream” from the URL written to “FileOutputStream”) downloads something and creates the file. Opening it with WinZip / 7-Zip, it contains one file called "guava-testlib-10.0", which looks like the jar archive that I expected to receive.
wget another jar works as expected, at least sometimes (with user agent string -U )
Is this some tricky interaction between wget / maven or Java / maven? Is this the wrong jar file that my browser correctly understands and downloads? Both of them seem implausible to me.
java jar maven guava wget
Joe kearney
source share