ProxyMan icon indicating copy to clipboard operation
ProxyMan copied to clipboard

Implement proxy settings for Maven

Open MaurizioCasciano opened this issue 7 years ago • 4 comments

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/

MaurizioCasciano avatar Mar 16 '18 14:03 MaurizioCasciano

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.

himanshub16 avatar Apr 04 '18 17:04 himanshub16

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 <existing_code> 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 <existing_code> 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?

joselescudero avatar Sep 19 '19 15:09 joselescudero

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)?

himanshub16 avatar Sep 19 '19 20:09 himanshub16

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

rishabhdeepsingh avatar Dec 09 '19 20:12 rishabhdeepsingh