Skip to content
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

Implement proxy settings for Maven #47

Open
MaurizioCasciano opened this issue Mar 16, 2018 · 4 comments
Open

Implement proxy settings for Maven #47

MaurizioCasciano opened this issue Mar 16, 2018 · 4 comments
Labels

Comments

@MaurizioCasciano
Copy link

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
Copy link
Owner

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
Copy link

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?

@himanshub16
Copy link
Owner

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
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants