-
Bug
-
Resolution: Unresolved
-
Major
-
None
Set up a socks proxy using ssh from the jenkins server to another server you wish to use the internet connection of.
ssh -v -D 8080 ipproxy@other.server
Set the following in your maven_opts on the jenkins job.
-DsocksProxyHost=127.0.0.1 -DsocksProxyPort=8080
Job Fails with the following exception.
Exception in thread "main" java.net.SocketException: Malformed reply from SOCKS server
at java.net.SocksSocketImpl.readSocksReply(SocksSocketImpl.java:129)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:502)
at java.net.Socket.connect(Socket.java:579)
at java.net.Socket.connect(Socket.java:528)
at java.net.Socket.<init>(Socket.java:425)
at java.net.Socket.<init>(Socket.java:208)
at org.jvnet.hudson.maven3.agent.Maven3Main.main(Maven3Main.java:130)
at org.jvnet.hudson.maven3.agent.Maven3Main.main(Maven3Main.java:65)
ERROR: Failed to launch Maven. Exit code = 1
Finished: FAILURE
exurpt of code in org.jvnet.hudson.maven3.agent.Maven3Main
String mavenRemoteUseInetEnvVar = System.getenv( "MAVEN_REMOTE_USEINET" );
boolean mavenRemoteUseInet = Boolean.parseBoolean( mavenRemoteUseInetEnvVar );
if(mavenRemoteUseInet)
{ InetAddress host = InetAddress.getLocalHost(); String hostname = host.getHostName(); System.out.println( "use inet address " + hostname ); s = new Socket(hostname,tcpPort); } else
s = new Socket((String)null,tcpPort);
I fought a losing battle with this flaw for a long time before a coworker suggested a workaround.
Instead of passing "-DsocksProxyHost=127.0.0.1 -DsocksProxyPort=8080" to MAVEN_OPTS as defined by the Jenkins maven-plugin, put those arguments in the "Goals and Options" of the maven build.
I believe that the MAVEN_OPTS defined in this plugin is passed to the invocation of the maven_plugin, and not the (subsequently) called, maven executable.