maven編譯工程報錯apache
[ERROR] Failed to execute goal net.alchim31.maven:scala-maven-plugin:3.2.2:add-source (scala-compile-first) on project trade: Execution scala-compile-first of goal net.alchim31.maven:scala-maven-plugin:3.2.2:add-source failed: Plugin net.alchim31.maven:scala-maven-plugin:3.2.2 or one of its dependencies could not be resolved: Failed to collect dependencies at net.alchim31.maven:scala-maven-plugin:jar:3.2.2 -> org.apache.maven:maven-core:jar:3.0.4 -> org.apache.maven:maven-model:jar:3.0.4: Failed to read artifact descriptor for org.apache.maven:maven-model:jar:3.0.4: Could not transfer artifact org.apache.maven:maven-model:pom:3.0.4 from/to central (https://repo.maven.apache.org/maven2): Received fatal alert: protocol_version -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginResolutionException瀏覽器
可是手工經過瀏覽器訪問maven倉庫一切正常maven
手工下載放到本地repository,而後再編譯,這個錯沒了,又報下一個錯,這麼多包一個一個手工下載實在傷不起,ui
wtf,仔細一看,報錯還有一句:Received fatal alert: protocol_versionurl
原來是由於這個,官網地址:https://central.sonatype.org/articles/2018/May/04/discontinued-support-for-tlsv11-and-below/ scala
這裏粘貼一下answer:debug
If you are using http to access Central, or Java 8+ with https urls, you are not affected.code
If you are on Java 7, it supports TLS 1.2 but it is disabled by default in versions before 1.7.0_131-b31, and the following Apache Maven workaround functions for older Java 7 users:orm
mvn -Dhttps.protocols=TLSv1,TLSv1.1,TLSv1.2 <goals>or add the following to your environment or build script:blog
export MAVEN_OPTS=-Dhttps.protocols=TLSv1,TLSv1.1,TLSv1.2If you are on Java 6, you will need to switch back to http or upgrade to a more modern Java version. Very recent versions of Java 6 claim to have TLS 1.2 support, but we have not confirmed it yet.
原來是由於maven中央倉庫再也不支持TLSv1.1致使,jdk改成1.8問題解決。