gradle配置远程仓库(以及使用本地maven仓库)

 

allprojects{

  repositories {

    mavenLocal()

    def REPOSITORY_URL = 'http://maven.aliyun.com/nexus/content/groups/public/'

      all { ArtifactRepository repo ->

        if(repo instanceof MavenArtifactRepository){

          def url = repo.url.toString()

          if (url.startsWith('https://repo1.maven.org/maven2') || url.startsWith('https://jcenter.bintray.com/')) {

            project.logger.lifecycle "Repository ${repo.url} replaced by $REPOSITORY_URL."

            remove repo

          }

       }

    }

    maven {

      url REPOSITORY_URL

    }

  }

}

 

posted @ 2018-06-18 07:40  lakeslove  阅读(1207)  评论(0编辑  收藏  举报