3

Java version: 1.8.0 ant version: 1.7.1

I am trying to execute this ant to build jar file. This ant also does http connection to maven to download some jar files:

Since I am behind proxy, I do this first:

export ANT_OPTS="-Dhttp.proxyHost=prod.proxy.net -Dhttp.proxyPort=8080 -Dhttp.proxyUsername=smithJ -Dhttp.proxyPassword=Basketball123"

then I execute this:

CLASSPATH=/app/hbase-0.94.27/lib/hadoop-core-1.0.4.jar CFLAGS=-m64 CXXFLAGS=-m64 ant -v compile-native tar

I get these errors:

ivy-download:
      [get] Getting: http://repo2.maven.org/maven2/org/apache/ivy/ivy/2.2.0/ivy-2.2.0.jar
      [get] To: /app/hadoop-lzo/ivy/ivy-2.2.0.jar
      [get] Error opening connection java.io.IOException: Server returned HTTP response code: 407 for URL: http://repo2.maven.org/maven2/org/apache/ivy/ivy/2.2.0/ivy-2.2.0.jar
      [get] Error opening connection java.io.IOException: Server returned HTTP response code: 407 for URL: http://repo2.maven.org/maven2/org/apache/ivy/ivy/2.2.0/ivy-2.2.0.jar
      [get] Error opening connection java.io.IOException: Server returned HTTP response code: 407 for URL: http://repo2.maven.org/maven2/org/apache/ivy/ivy/2.2.0/ivy-2.2.0.jar
      [get] Can't get http://repo2.maven.org/maven2/org/apache/ivy/ivy/2.2.0/ivy-2.2.0.jar to /app/hadoop-lzo/ivy/ivy-2.2.0.jar

407 errors are proxy authentication errors. What am I doing wrong here? How would I authenticate in proxy to get http files?

I also tried this:

 CLASSPATH=/app/hbase-0.94.27/lib/hadoop-core-1.0.4.jar CFLAGS=-m64 CXXFLAGS=-m64 ant -Dhttp.proxyHost=prod.proxy.net -Dhttp.proxyPort=8080 -Dhttp.proxyUsername=smithJ -Dhttp.proxyPassword=Basketball123  compile-native tar

still 407 errors.

user1471980
  • 10,127
  • 48
  • 136
  • 235

1 Answers1

2

Check this:

set ANT_OPTS=-Dhttp.proxyHost=myproxyhost -Dhttp.proxyPort=8080 -Dhttp.proxyUser=myproxyusername -Dhttp.proxyPassword=myproxypassword -Dhttps.proxyHost=myproxyhost -Dhttps.proxyPort=8080

The guide is "-Dhttp.proxyUser" instead of in your case"-Dhttp.proxyUsername=smithJ", that's why I always tell others copy instead of typing.

Guide here:http://ant.apache.org/ivy/faq.html

Jerry Z.
  • 2,031
  • 3
  • 22
  • 28
  • you are using this proxy for other applications? – Jerry Z. Jun 13 '15 at 15:20
  • yes, I can set up proxy in my shell to wget stuf from internet – user1471980 Jun 13 '15 at 15:21
  • if you are giving a wrong password, will the error code change? – Jerry Z. Jun 13 '15 at 15:27
  • 1
    I changed the password to something different, still 407 error code. I am issuing set ANT_OPTS in my current shell, right before the ant command. Do I need to insert set ANT_OPTS in any profile file like /etc/profile.d/java.sh? – user1471980 Jun 13 '15 at 15:29
  • http://stackoverflow.com/questions/14113341/http-407-proxy-authentication-required-how-to-handle-in-java-code I was just reading this answer, I think that's some problem with ANT or the HTTP lib ANT depends. – Jerry Z. Jun 13 '15 at 15:32
  • If it still doesn't work, maybe it's your dependency file which is not ok. Check if the module name you depend on is actually a name of directory under www.ibiblio.org/maven/. If this is the case, check if the jar with a name like [module]-[revision].jar is present under the jars directory of this module on ibiblio. For instance: www.ibiblio.org/maven/commons-httpclient/jars/commons-httpclient-2.0.jar – Jerry Z. Jun 13 '15 at 15:32
  • Last comment was coping from http://ant.apache.org/ivy/faq.html, it suggests you checking the httpclient that ANT required. Let's try if the httpclient 2.0 solve that problem. – Jerry Z. Jun 13 '15 at 15:33
  • I do set APT_OPT=, when I do echo APT_OPT, I only get back this: -Dhttp.proxyHost=prod.proxy.net – user1471980 Jun 13 '15 at 15:36
  • I exited out from shell, do another set ANT_OPTS and echo $ANT_OPTS does not show anything. Now I dont even get the errors, it just hangs. – user1471980 Jun 13 '15 at 15:42
  • Put "commons-httpclient:commons-httpclient:3.1" jar into your classpath, and try again. – Jerry Z. Jun 14 '15 at 00:51
  • the same error, ant is not able to connect to maven via http proxy. – user1471980 Jun 14 '15 at 17:31