Piotr Żygieło <piotr.zygi...@gmail.com> 于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 <hongyi.z...@gmail.com>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org

Reply via email to