Description: How to setup maven proxy server configuration in different version. It is common that companies block the direct access to internet for their stuff, in case we need to do some kind Java development in machine with maven, we have to setup the proxy setting.
I need to do some java POC project for my company, but large company alway comes with a lot of security restriction. One the restriction is that the internet is blocked behine a proxy server. In my previous experience, we could add some JVM arguments to setup the proxy setting.
At the time, I wrote this article, the official version of maven is 3.9. After some test, I found that the some previouse working solution no long work again.
Below are the solution, the I came up after few hours research.
Lets said are behind the proxy server with host equals 127.0.0.1 and port equals 8080.
This solution no longer working any, due to the maven repository has fade out the http repo. The maven artifact will fail to be fetch due to ssl verification fail (Companies alway switch the ssl certificate for any http request).
-Dhttp.proxyHost=127.0.0.1 \
-Dhttp.proxyPort=8080 \
-Dhttps.proxyHost=127.0.0.1 \
-Dhttps.proxyPort=8080
Stackoverflow Imporved based on solution 1
-Dhttp.proxyHost=127.0.0.1 \
-Dhttp.proxyPort=8080 \
-Dhttps.proxyHost=127.0.0.1 \
-Dhttps.proxyPort=8080 \
-Dmaven.wagon.http.ssl.insecure=true \
-Dmaven.wagon.http.ssl.allowall=true \
-Dmaven.wagon.http.ssl.ignore.validity.dates=true \
-Dmaven.resolver.transport=wagon
-Dhttp.proxyHost=127.0.0.1 \
-Dhttp.proxyPort=8080 \
-Dhttps.proxyHost=127.0.0.1 \
-Dhttps.proxyPort=8080 \
-Daether.connector.https.securityMode=insecure \
-Daether.connector.http.useSystemProperties=true