-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
walkmod not working behind a proxy (with resolution) #90
Comments
Ok!
Thank you so much! I'll review it in the next days
El vie., 15 nov. 2019 11:20, vladislav-knoll <[email protected]>
escribió:
… I wasn't able to use walkmod behind a corporate proxy, because the
PrintPluginsCommand tries connect to the MVN_SEARCH_URL to get all
available plugins and walks into an Exception.
I was able to avoid this issue by writing a ProxyUrlUtil
package org.walkmod.util;
import java.io.IOException;
import java.io.InputStream;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.Proxy;
import java.net.Proxy.Type;
import java.net.URL;
public class ProxyUrlUtil {
public static InputStream openURL(String url) throws IOException {
String[] proxyHost = System.getProperty("http.proxyHost").split("\\."); //$NON-NLS-1$ //$NON-NLS-2$
int proxyPort = Integer.parseInt(System.getProperty("http.proxyPort")); //$NON-NLS-1$
Proxy proxy = null;
if (proxyHost != null) {
byte[] proxyAddress = new byte[4];
for (int i = 0; i < 4; i++) {
proxyAddress[i] = (byte) Integer.parseInt(proxyHost[i]);
}
InetAddress address = InetAddress.getByAddress(proxyAddress);
InetSocketAddress socket = new InetSocketAddress(address, proxyPort);
proxy = new Proxy(Type.HTTP, socket);
}
if (proxy != null) {
return new URL(url).openConnection(proxy).getInputStream();
} else {
return new URL(url).openStream();
}
}
}
and using it in the *org.walkmod.commands.PrintPluginsCommand*
is = ProxyUrlUtil.openURL(MVN_SEARCH_URL);
projectIs = ProxyUrlUtil.openURL(artifactDetailsURL);
Furthermore you have to insert your http.proxyHost and http.proxyPort in
the the *walkmod.bat*
@set WALKMOD_OPTS=-Dhttp.proxyHost=<MY_PROXY_HOST>
-Dhttp.proxyPort=<MY_PROXY_PORT>
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#90?email_source=notifications&email_token=ACNDOQ5TESVVVDAZFKOUT6DQTZZXPA5CNFSM4JNYWKQKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HZSGD7Q>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACNDOQ7DLJWJ25K6P6RPEJ3QTZZXPANCNFSM4JNYWKQA>
.
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I wasn't able to use walkmod behind a corporate proxy, because the
PrintPluginsCommand
tries connect to theMVN_SEARCH_URL
to get all available plugins and walks into an Exception.I was able to avoid this issue by writing a
ProxyUrlUtil
and using it in the org.walkmod.commands.PrintPluginsCommand
is = ProxyUrlUtil.openURL(MVN_SEARCH_URL);
projectIs = ProxyUrlUtil.openURL(artifactDetailsURL);
Furthermore you have to insert your
http.proxyHost
andhttp.proxyPort
in the the walkmod.bat@set WALKMOD_OPTS=-Dhttp.proxyHost=<MY_PROXY_HOST> -Dhttp.proxyPort=<MY_PROXY_PORT>
The text was updated successfully, but these errors were encountered: