1. 程式人生 > >解決在gradle構建project時,發生peer not authenticated錯誤的方法

解決在gradle構建project時,發生peer not authenticated錯誤的方法

開發十年,就只剩下這套架構體系了! >>>   

問題:

FAILURE: Build failed with an exception.

* What went wrong:
Could not resolve all dependencies for configuration ':wl01-service:compile'.
> Could not resolve com.alibaba:fastjson:1.2.56.
  Required by:
      cn.wl01:wl01-service:1.0
   > Could not GET '
http://maven.aliyun.com/nexus/content/groups/public/com/alibaba/fastjson/1.2.56/fastjson-1.2.56.pom
'. > peer not authenticated > Could not GET 'http://maven.aliyun.com/nexus/content/groups/public/com/alibaba/fastjson/1.2.56/fastjson-1.2.56.pom'. > peer not authenticated

解決方法:

在build.gradle檔案上新增下面任意一個配置

repositories {
    jcenter {
        url "http://jcenter.bintray.com/"
    }
}


repositories {
    maven  {
        url "http://repo1.maven.org/maven2"
    }
}

原因:

Warning: Be aware that the central Maven 2 repository is HTTP only 
and HTTPS is not supported. If you need a public HTTPS enabled 
central repository, you can use the JCenter public repository 
(see Section 51.6.3, “Maven JCenter rep