美文网首页
Spring (1)源码阅读环境

Spring (1)源码阅读环境

作者: 百炼 | 来源:发表于2019-08-12 09:27 被阅读0次

date[2019-08-12]
[TOC]
上传仓库地址

Spring源码环境准备

  1. clone Spring源码,并checkout指定版本(以v5.1.12.RELEASE为例)
    //git checkout -b [分支名称] [tag标签名称]
    $git clone -b v5.1.12.RELEASE https://github.com/spring-projects/spring-framework.git
    
  2. 配置gradle,以win10为例
    • gradle加path环境变量
    • 新增环境变量GRADLE_USER_HOME,设置成maven的repository
    • 配置 (使用aliyun) C:\Users[用户名].gradle\init.gradle
allprojects{
    repositories {
        def ALIYUN_REPOSITORY_URL = 'http://maven.aliyun.com/nexus/content/groups/public'
        maven {
            url ALIYUN_REPOSITORY_URL
        }
    }
}
  1. 注释settings.gradle以下内容
    artifacts {
    // archives docsZip
    // archives schemaZip
    // archives distZip
    }

  2. 进入主目录,执行 gradlew.bat build

init.gralde配置参考

      allprojects{
          repositories {
              def ALIYUN_REPOSITORY_URL = 'http://maven.aliyun.com/nexus/content/groups/public'
              def ALIYUN_JCENTER_URL = 'http://maven.aliyun.com/nexus/content/repositories/jcenter'
              def SPRINGSOURCE_URL = 'http://repo.springsource.org/plugins-release'
              all { ArtifactRepository repo ->
                  if(repo instanceof MavenArtifactRepository){
                      def url = repo.url.toString()
                      if (url.startsWith('https://repo1.maven.org/maven2')) {
                          project.logger.lifecycle "Repository ${repo.url} replaced by $ALIYUN_REPOSITORY_URL."
                          remove repo
                      }
                      if (url.startsWith('https://jcenter.bintray.com/')) {
                          project.logger.lifecycle "Repository ${repo.url} replaced by $ALIYUN_JCENTER_URL."
                          remove repo
                      }
                  }
              }
      
              maven {
                  url ALIYUN_REPOSITORY_URL
                  url ALIYUN_JCENTER_URL
                  url SPRINGSOURCE_URL
              }
          }
      }  

相关文章

网友评论

      本文标题:Spring (1)源码阅读环境

      本文链接:https://www.haomeiwen.com/subject/nhhyjctx.html