Re: Setting socks5 proxy for maven using settings.xml doesn't take effect.
Piotr Żygieło 于2020年5月31日周日 下午7:21写道: > > > 2. Then I try to use the environment variable based method to set the > > proxy but failed to confirm it. See the following for more info: > > > > > > Use the proxy setting directly in maven's command options: > > Or define them in the MAVEN_OPTS environment variable: > > > > As you can see, in this case, it seems the http proxy passed as > > command options or set by environment variable doesn't picked up by > > maven at all. Any hints for this problem? > > https://docs.oracle.com/javase/7/docs/technotes/guides/net/proxies.html > > Just guessing. > The -D options you use are intended and consumed by JVM itself. Greping in the maven installation directory also confirms the above comment: $ grep -inR 'MAVEN_OPTS' . | grep -i java ./3.6.3/bin/mvnDebug:26:# MAVEN_OPTS (Optional) Java runtime options used when Maven is executed. > That's why socks proxy works when configured with > socksProxyHost/socksProxyPort, because maven even doesn't know about > traffic being proxied. > > P. > > - > To unsubscribe, e-mail: users-unsubscr...@maven.apache.org > For additional commands, e-mail: users-h...@maven.apache.org > -- Hongyi Zhao - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: Setting socks5 proxy for maven using settings.xml doesn't take effect.
Piotr Żygieło 于2020年5月31日周日 下午7:21写道: > > > 2. Then I try to use the environment variable based method to set the > > proxy but failed to confirm it. See the following for more info: > > > > > > Use the proxy setting directly in maven's command options: > > Or define them in the MAVEN_OPTS environment variable: > > > > As you can see, in this case, it seems the http proxy passed as > > command options or set by environment variable doesn't picked up by > > maven at all. Any hints for this problem? > > https://docs.oracle.com/javase/7/docs/technotes/guides/net/proxies.html > > Just guessing. > The -D options you use are intended and consumed by JVM itself. > That's why socks proxy works when configured with > socksProxyHost/socksProxyPort, because maven even doesn't know about > traffic being proxied. Seems you are right. I confirmed the socks5 proxy is in effect by the following methods: First start a tcpdump process for capture the packages on the socks5 proxy port, say tor used here: $ sudo tcpdump -i lo 'port 9050' Then running the maven with the following methods: # Prevent maven from using the locally cached packages: $ rm -fr ~/.m2/repository/ $ export MAVEN_OPTS="-DsocksProxyHost=127.0.0.1 -DsocksProxyPort=9050" $ mvn -X clean install or using the following one-line command: $ mvn -X clean install -DsocksProxyHost=127.0.0.1 -DsocksProxyPort=9050 In both cases, there will be many packages captured by tcpdump on tor port 9050 once maven downloads from remote repository. Regards, HY > > P. > > - > To unsubscribe, e-mail: users-unsubscr...@maven.apache.org > For additional commands, e-mail: users-h...@maven.apache.org > -- Hongyi Zhao - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: Setting socks5 proxy for maven using settings.xml doesn't take effect.
> 2. Then I try to use the environment variable based method to set the > proxy but failed to confirm it. See the following for more info: > > > Use the proxy setting directly in maven's command options: > Or define them in the MAVEN_OPTS environment variable: > > As you can see, in this case, it seems the http proxy passed as > command options or set by environment variable doesn't picked up by > maven at all. Any hints for this problem? https://docs.oracle.com/javase/7/docs/technotes/guides/net/proxies.html Just guessing. The -D options you use are intended and consumed by JVM itself. That's why socks proxy works when configured with socksProxyHost/socksProxyPort, because maven even doesn't know about traffic being proxied. P. - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: Setting socks5 proxy for maven using settings.xml doesn't take effect.
Hongyi Zhao 于2020年5月31日周日 下午6:34写道: > > Michael Osipov 于2020年5月31日周日 下午3:56写道: > > > > Am 2020-05-31 um 03:31 schrieb Hongyi Zhao: > > > Hi, > > > > > > I'm using Ubuntu 20.04 and installed maven using ` sudo apt-get > > > install maven `. Now, I want to set socks5 proxy for maven. > > > > We don't support Debian-packaged Maven versions for various reasons. > > > > > When I set > > > it via environment variable liek this: > > > > > > export MAVEN_OPTS="-DsocksProxyHost=127.0.0.1 -DsocksProxyPort=18887" > > > > > > It can work smoothly. > > > > Define works! what exactly works? > > > > > But if I set it by using ` ~/.m2/setting.xml ', the socks5 proxy > > > cannot be used at all. The content of the setting.xml file is as > > > following: > > > > > > > > > > > >ss > > >true > > >socks5 > > > > > > > > >127.0.0.1 > > >18887 > > >127.0.0.1 > > > > > > > > > > If you want to use HTTP transport (Resolver/Wagon) via Socks 5 proxy, it > > will not work because Apche HttpClient does not support Socks5 proxies > > with our setup. > > > Thanks for your explanations. But I still have some confusions on the > proxy usage. See my following testings. > > All the following testings are using the xdm which is a maven project, > see here for more info: > https://github.com/subhra74/xdm#building-from-source > > The following steps for based on the instructions here: > https://www.baeldung.com/maven-behind-proxy > > 1. For the settings.xml based proxy setting, I can confirm maven works > via the http proxy set by me in the file ~/.m2/settings.xml.save which > has the following content: > > > > > > ss > true > http > 127.0.0.1 > 8080 > localhost|127.*|[::1] > > > > > Then the following confirms that the proxy is works: > > $ mvn -s ~/.m2/settings.xml.save -X clean install | grep 'Using > connector BasicRepositoryConnector' > [DEBUG] Using connector BasicRepositoryConnector with priority 0.0 for > https://repo.maven.apache.org/maven2 via 127.0.0.1:8080 > > 2. Then I try to use the environment variable based method to set the > proxy but failed to confirm it. See the following for more info: > > > Use the proxy setting directly in maven's command options: > > $ mvn -X clean install -D"http.proxyHost=127.0.0.1 > -Dhttp.proxyPort=8080 -Dhttp.nonProxyHosts=localhost|127.0.0.1" | grep > 'Using connector BasicRepositoryConnector' > [DEBUG] Using connector BasicRepositoryConnector with priority 0.0 for > https://repo.maven.apache.org/maven2 Sorry for my typo in the above command. It should be tested as follows: $ mvn -X clean install "-Dhttp.proxyHost=127.0.0.1 -Dhttp.proxyPort=8080" | grep 'Using connector BasicRepositoryConnector' [DEBUG] Using connector BasicRepositoryConnector with priority 0.0 for https://repo.maven.apache.org/maven2 > > Or define them in the MAVEN_OPTS environment variable: > > $ export MAVEN_OPTS="-DhttpProxyHost=127.0.0.1 -DhttpProxyPort=8080" > $ mvn -X clean install | grep 'Using connector BasicRepositoryConnector' > [DEBUG] Using connector BasicRepositoryConnector with priority 0.0 for > https://repo.maven.apache.org/maven2 > > > As you can see, in this case, it seems the http proxy passed as > command options or set by environment variable doesn't picked up by > maven at all. Any hints for this problem? > > Regards, > HY > > > > > - > > To unsubscribe, e-mail: users-unsubscr...@maven.apache.org > > For additional commands, e-mail: users-h...@maven.apache.org > > > > > -- > Hongyi Zhao -- Hongyi Zhao - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: Setting socks5 proxy for maven using settings.xml doesn't take effect.
Michael Osipov 于2020年5月31日周日 下午3:56写道: > > Am 2020-05-31 um 03:31 schrieb Hongyi Zhao: > > Hi, > > > > I'm using Ubuntu 20.04 and installed maven using ` sudo apt-get > > install maven `. Now, I want to set socks5 proxy for maven. > > We don't support Debian-packaged Maven versions for various reasons. > > > When I set > > it via environment variable liek this: > > > > export MAVEN_OPTS="-DsocksProxyHost=127.0.0.1 -DsocksProxyPort=18887" > > > > It can work smoothly. > > Define works! what exactly works? > > > But if I set it by using ` ~/.m2/setting.xml ', the socks5 proxy > > cannot be used at all. The content of the setting.xml file is as > > following: > > > > > > > >ss > >true > >socks5 > > > > > >127.0.0.1 > >18887 > >127.0.0.1 > > > > > > If you want to use HTTP transport (Resolver/Wagon) via Socks 5 proxy, it > will not work because Apche HttpClient does not support Socks5 proxies > with our setup. Thanks for your explanations. But I still have some confusions on the proxy usage. See my following testings. All the following testings are using the xdm which is a maven project, see here for more info: https://github.com/subhra74/xdm#building-from-source The following steps for based on the instructions here: https://www.baeldung.com/maven-behind-proxy 1. For the settings.xml based proxy setting, I can confirm maven works via the http proxy set by me in the file ~/.m2/settings.xml.save which has the following content: ss true http 127.0.0.1 8080 localhost|127.*|[::1] Then the following confirms that the proxy is works: $ mvn -s ~/.m2/settings.xml.save -X clean install | grep 'Using connector BasicRepositoryConnector' [DEBUG] Using connector BasicRepositoryConnector with priority 0.0 for https://repo.maven.apache.org/maven2 via 127.0.0.1:8080 2. Then I try to use the environment variable based method to set the proxy but failed to confirm it. See the following for more info: Use the proxy setting directly in maven's command options: $ mvn -X clean install -D"http.proxyHost=127.0.0.1 -Dhttp.proxyPort=8080 -Dhttp.nonProxyHosts=localhost|127.0.0.1" | grep 'Using connector BasicRepositoryConnector' [DEBUG] Using connector BasicRepositoryConnector with priority 0.0 for https://repo.maven.apache.org/maven2 Or define them in the MAVEN_OPTS environment variable: $ export MAVEN_OPTS="-DhttpProxyHost=127.0.0.1 -DhttpProxyPort=8080" $ mvn -X clean install | grep 'Using connector BasicRepositoryConnector' [DEBUG] Using connector BasicRepositoryConnector with priority 0.0 for https://repo.maven.apache.org/maven2 As you can see, in this case, it seems the http proxy passed as command options or set by environment variable doesn't picked up by maven at all. Any hints for this problem? Regards, HY > > - > To unsubscribe, e-mail: users-unsubscr...@maven.apache.org > For additional commands, e-mail: users-h...@maven.apache.org > -- Hongyi Zhao - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: Setting socks5 proxy for maven using settings.xml doesn't take effect.
Michael Osipov 于2020年5月31日周日 下午3:56写道: > > Am 2020-05-31 um 03:31 schrieb Hongyi Zhao: > > Hi, > > > > I'm using Ubuntu 20.04 and installed maven using ` sudo apt-get > > install maven `. I've installed the latest version from maven official website and set the PATH to override the system's maven, so this should be no need for my case. See the following for more info. > Now, I want to set socks5 proxy for maven. > > We don't support Debian-packaged Maven versions for various reasons. Sorry for above descriptions, in fact, I use the pre-compiled package supplied by maven official website here: https://apachemirror.sg.wuchna.com/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz See the following for more information: $ which mvn /opt/apache-maven/3.6.3/bin/mvn > > > When I set > > it via environment variable liek this: > > > > export MAVEN_OPTS="-DsocksProxyHost=127.0.0.1 -DsocksProxyPort=18887" > > > > It can work smoothly. > > Define works! what exactly works? It seems I'm wrong. Even with the above enviroment variable, I still see the following info: $ mvn -X clean install | grep 'Using connector BasicRepositoryConnector' [DEBUG] Using connector BasicRepositoryConnector with priority 0.0 for https://repo.maven.apache.org/maven2 ^C Obviously, there are no proxy activated for the connection. In the previously postings, due that there are so many packages have already been downloaded into the local repository here: ~/.m2/repository/, which makes the maven compile procedure so fast and doesn't need to download them from the remote repository. As a result, I simply think that it's the socks5 proxy that speed up the remote packages downloading progress. > > > But if I set it by using ` ~/.m2/setting.xml ', the socks5 proxy > > cannot be used at all. The content of the setting.xml file is as > > following: > > > > > > > >ss > >true > >socks5 > > > > > >127.0.0.1 > >18887 > >127.0.0.1 > > > > > > If you want to use HTTP transport (Resolver/Wagon) via Socks 5 proxy, it > will not work because Apche HttpClient does not support Socks5 proxies > with our setup. Got it, thanks for your clarification. Regards, HY > > - > To unsubscribe, e-mail: users-unsubscr...@maven.apache.org > For additional commands, e-mail: users-h...@maven.apache.org > -- Hongyi Zhao - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: Setting socks5 proxy for maven using settings.xml doesn't take effect.
Am 2020-05-31 um 03:31 schrieb Hongyi Zhao: Hi, I'm using Ubuntu 20.04 and installed maven using ` sudo apt-get install maven `. Now, I want to set socks5 proxy for maven. We don't support Debian-packaged Maven versions for various reasons. When I set it via environment variable liek this: export MAVEN_OPTS="-DsocksProxyHost=127.0.0.1 -DsocksProxyPort=18887" It can work smoothly. Define works! what exactly works? But if I set it by using ` ~/.m2/setting.xml ', the socks5 proxy cannot be used at all. The content of the setting.xml file is as following: ss true socks5 127.0.0.1 18887 127.0.0.1 If you want to use HTTP transport (Resolver/Wagon) via Socks 5 proxy, it will not work because Apche HttpClient does not support Socks5 proxies with our setup. - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org