himanshub16 / ProxyMan

Configuring proxy settings made easy.
https://github.com/himanshub16/ProxyMan/releases/latest/
MIT License
683 stars 108 forks source link

Implement proxy settings for Maven #47

Open MaurizioCasciano opened 6 years ago

MaurizioCasciano commented 6 years ago

It would be good to have the proxy settings for Maven too. Since the proxy settings for Maven are stored in an XML file, it may help using http://xmlstar.sourceforge.net/

himanshub16 commented 6 years ago

Hi @izio7 Since I have never interacted with Maven and is not something someone ever reported a problem to me (perhaps because they were willing enough to configure it), I request contributions to handle this.

Also, instead of adding a dependency to handle XML configurations, it'd better use primitive UNIX tools like sed, grep, etc. the way they are being used throughout ProxyMan.

joselescudero commented 4 years ago

Hello, Maybe is not the best solution but I'm using maven and I´ve configured it setting the MAVEN_OPTS variable in shellrc.sh:

if [ "$USE_HTTP_PROXY_FOR_HTTPS" = "true" ]; then

echo "export MAVEN_OPTS=\"-Dhttp.proxyHost=${stmt}${http_host} -Dhttp.proxyPort=${http_port} -Dhttps.proxyHost=${stmt}${http_host} -Dhttps.proxyPort=${http_port} -Dhttp.nonProxyHosts=${no_proxy//,/|}"\" >> "$SHELLRC" else echo "export MAVEN_OPTS=\"-Dhttp.proxyHost=${stmt}${http_host} -Dhttp.proxyPort=${http_port} -Dhttps.proxyHost=${stmt}${https_host} -Dhttps.proxyPort=${https_port} -Dhttp.nonProxyHosts=${no_proxy//,/|}"\" >> "$SHELLRC" fi Probably it should be enhanced to include also the SOCKS proxy but I am not able to test it. The previous configuration works for me. Should I create a pull request?
himanshub16 commented 4 years ago

Not very sure about the conditions where Maven requires proxy to be configured. I've been using maven and gradle for a while behind proxy, and they seem to work fine using environment variables (http_proxy from bashrc). It would be helpful to know your OS details - the less to maintain, the better.

I am very new to Java world, but if we are exporting MAVEN_OPTS environment variable, how can the user add more parameters to $MAVEN_OPTS (something like export MAVEN_OPTS="$MAVEN_OPTS:-Dsomesetting=somevalue" without modifying existing scripts (if any)? Will the user have to update his/her scripts to make sure they have both options (this and theirs, if configured)?

rishabhdeepsingh commented 4 years ago

I think this is fixable as we can create .m2/settings.xml file where we can store the proxies and it should work.