问题
I'm trying to enable TSLv1.2 in my machine which has java 1.7 using the commands -mvn -Dhttps.protocols=TLSv1,TLSv1.1,TLSv1.2 install / mvn -Dhttps.protocols=TLSv1.2 install. But its throwing some errors saying my pom.xml has some unresolved dependencies, those dependencies errors are there because my project couldn't download from maven repository due to TSLv1.2 issue. Seems like a deadlock to me, Can anyone help me on how to resolve it?
回答1:
You need to configure MAVEN_OPTS
env variable or settings.xml to pass proper vm args to JVM (maven JVM)
For quick test, try this
set MAVEN_OPTS
with -Dhttps.protocols=TLSv1.2,TLSv1.1
export MAVEN_OPTS=-Dhttps.protocols=TLSv1.2,TLSv1.1
(export is for unix based system, for windows see here)
and re-run your maven command
read more on maven's configuration
来源:https://stackoverflow.com/questions/53136649/how-to-enable-tlsv1-2-in-java-7