Reputation: 28734
My machine is using proxy to connect internet. But I get the following error when running maven build command. And it works when I disable proxy. I don't understand why proxy matters here.
[ERROR] Failed to execute goal on project flink-dist_2.11: Could not resolve dependencies for project org.apache.flink:flink-
dist_2.11:jar:1.7-SNAPSHOT: Failed to collect dependencies at
org.apache.flink:flink-shaded-hadoop2-uber:jar:1.7-SNAPSHOT:
Failed to read artifact descriptor for org.apache.flink:flink-shaded-hadoop2-uber:jar:1.7-SNAPSHOT:
Could not transfer artifact
org.apache.flink:flink-shaded-hadoop2-uber:pom:1.7-SNAPSHOT from/to apache.snapshots (https://repository.
apache.org/snapshots): Remote host closed connection during handshake: SSL peer shut down incorrectly -> [Help 1]
Upvotes: 1
Views: 3454
Reputation: 22646
I faced to the same problem at my work where we have Windows
workstations and NTLM2
proxy server with authentication.
The following solution works fine for me. The benefit of this solution is that it can work with Maven, Git, IntelliJ IDE as well.
Reccomended steps you need to accomplish in order to have access via NTLM2 proxy:
Cntlm
proxy on your pc.localhost:3128
. You do not need to configure authentication here.Details:
Type cntlm.exe -H -d your_domain -u your_username
.
It will ask your password. Enter it and Cntlm will give you the hashes, something like this:
Password:
PassLM 4E9C185932FER43543RWEFER33R4R34C
PassNT 6E9F1254353RDR34RFSDWER3443RDC9A
PassNTLMv2 43534RFWDWE3434RWFWER434C4FA224F
Edit / check your cntlm.ini
file
Username <your-domain-username>
Domain <windows-donain-name>
Auth NTLMv2
PassNTLMv2 <hash>
Proxy <proxy-host:port>
NoProxy localhost, 127.0.0.*, 10.*, 192.168.*
Listen 3128
Start Cntlm with a simple script: start-proxy.cmd
cd %CNTLM_HOME%
rem verbose mode
cntlm -v -c cntlm.ini
rem verbose with logfile
rem cntlm -v -c cntlm.ini -T %CNTLM_HOME%\nctlm.log
rem test configuration
rem cntlm -c cntlm.ini -I -M http://google.com
Stop Cntlm server: stop-proxy.cmd
taskkill /IM cntlm.exe /F
Then you can create two cmd files which change Maven configuration as per your flavour:
mvn-internet.cmd
call java8.cmd
del %MAVEN_HOME%\conf\settings.xml
copy %MAVEN_HOME%\conf\settings.xml.internet %MAVEN_HOME%\conf\settings.xml
mvn-intranet.cmd
call java8.cmd
del %MAVEN_HOME%\conf\settings.xml
copy %MAVEN_HOME%\conf\settings.xml.nexus %MAVEN_HOME%\conf\settings.xml
settings.xml.internet
<settings xmlns=...>
<localRepository>...</localRepository>
<proxies>
<proxy>
<id>my-proxy</id>
<active>true</active>
<protocol>http</protocol>
<host>localhost</host>
<port>3128</port>
<nonProxyHosts>locahost</nonProxyHosts>
</proxy>
</proxies>
</settings>
settings.xml.nexus
<settings>
<localRepository>...</localRepository>
<mirrors>
<mirror>
<id>local-lalm</id>
<name>local-lalm</name>
<url>https://nexus.xxx...</url>
<mirrorOf>*</mirrorOf>
</mirror>
</mirrors>
<profiles>
<profile>
<id>use-local-repo</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<repositories>
<repository>
<id>LALM-global</id>
<url>https://nexus.xxx...</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>LALM-global</id>
<url>https://nexus.xxx...</url>
</pluginRepository>
</pluginRepositories>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
</profile>
</profiles>
</settings>
Do the same with Git
git-internet.cmd
call java8.cmd
rem git config --global http.proxy username:password@localhost:3128
git config --global http.proxy localhost:3128
git-intranet.cmd
call java8.cmd
git config --global --unset http.proxy
Cunfigure IntelliJ
Maven home directory
and User settings file
configs. After that you will use the same Maven configuration within IntelliJ and command line so everythink will work on the same way from IDE and comand line.
You can use your new cmd files to change between use or not proxy server on the fly.
This configuration takes 10 mins. and after that you can forgot this proxy issue.
Upvotes: 0
Reputation: 925
May be try this by configuring Mavan accordingly for using the proxy server:- https://dzone.com/articles/how-get-maven-working-through
Upvotes: 0
Reputation: 187
Remote host closed connection during handshake: SSL peer shut down incorrectly : This indicates that the server host that your are trying to achieve is down, verify first if the connection is well established and try again.
Upvotes: 0
Reputation: 115
Have you tried the settings.xml at ${user.home}/.m2/settings.xml , more guidance here https://maven.apache.org/guides/mini/guide-proxies.html
in windows7 and above it would be c:\users\user_name\.m2
Upvotes: 1
Reputation: 11946
Maven is trying to connect to a remote repository in order to downlod your project dependencies in its local repository. That's a network connection and obviously, your proxy configuration makes Maven fail in the attempt.
Upvotes: 0