教你使用IDEA搭建spring源码阅读环境的详细步骤
1、去官网下载gradlehttps://gradle.org/releases/
2、将其解压缩,创建repository文件夹 和init.d文件夹
创建init.gradle文件输入文本信息,主要是配置阿里云镜像仓库地址,和maven的类似
gradle.projectsLoaded { rootProject.allprojects {buildscript { repositories {def JCENTER_URL = ’https://maven.aliyun.com/repository/jcenter’def GOOGLE_URL = ’https://maven.aliyun.com/repository/google’def NEXUS_URL = ’http://maven.aliyun.com/nexus/content/repositories/jcenter’all { ArtifactRepository repo -> if (repo instanceof MavenArtifactRepository) {def url = repo.url.toString()if (url.startsWith(’https://jcenter.bintray.com/’)) { project.logger.lifecycle 'Repository ${repo.url} replaced by $JCENTER_URL.' println('buildscript ${repo.url} replaced by $JCENTER_URL.') remove repo}else if (url.startsWith(’https://dl.google.com/dl/android/maven2/’)) { project.logger.lifecycle 'Repository ${repo.url} replaced by $GOOGLE_URL.' println('buildscript ${repo.url} replaced by $GOOGLE_URL.') remove repo}else if (url.startsWith(’https://repo1.maven.org/maven2’)) { project.logger.lifecycle 'Repository ${repo.url} replaced by $REPOSITORY_URL.' println('buildscript ${repo.url} replaced by $REPOSITORY_URL.') remove repo} }}jcenter { url JCENTER_URL}google { url GOOGLE_URL}maven { url NEXUS_URL} }}repositories { def JCENTER_URL = ’https://maven.aliyun.com/repository/jcenter’ def GOOGLE_URL = ’https://maven.aliyun.com/repository/google’ def NEXUS_URL = ’http://maven.aliyun.com/nexus/content/repositories/jcenter’ all { ArtifactRepository repo ->if (repo instanceof MavenArtifactRepository) { def url = repo.url.toString() if (url.startsWith(’https://jcenter.bintray.com/’)) {project.logger.lifecycle 'Repository ${repo.url} replaced by $JCENTER_URL.'println('buildscript ${repo.url} replaced by $JCENTER_URL.')remove repo } else if (url.startsWith(’https://dl.google.com/dl/android/maven2/’)) {project.logger.lifecycle 'Repository ${repo.url} replaced by $GOOGLE_URL.'println('buildscript ${repo.url} replaced by $GOOGLE_URL.')remove repo } else if (url.startsWith(’https://repo1.maven.org/maven2’)) {project.logger.lifecycle 'Repository ${repo.url} replaced by $REPOSITORY_URL.'println('buildscript ${repo.url} replaced by $REPOSITORY_URL.')remove repo }} } jcenter {url JCENTER_URL } google {url GOOGLE_URL } maven {url NEXUS_URL }} }}
3、为了方便,设置环境变量GRADLE_HOME 和GRADLE_USER_HOME(看后面的截图就明白会被idea使用)
GRADLE_HOME
gradle路径,例如:
D:Program Filesgradle-6.8.3
第二步、下载spring源码github下载源码比较慢,我们通过码云的方式将其下载下来。当然也可以直接从github的官网直接拉取下拉。
spring源码官网:https://github.com/spring-projects/spring-framework
以下是同步到码云的操作
确认后就可以同步完成了由于从码云上拉取代码需要ssh校验
如果之前有弄过ssh-keygen -t rsa也就是在个人文件夹下有一个.ssh文件夹里面有一个公钥如下,讲id_rsa.pub已文本打开,复制里面的内容。
然后我们就可以通过IDEA的get from version control复制ssh的连接,然后粘贴到idea中,与github上的git操作一致
刷新以下gradle依赖,首次刷新会非常慢,如果遇到了错误提示,则根据错误提示进行处理。完成后就会像我这样。
完成上面操作后spring的源码环境就算完成了。
到此这篇关于用IDEA搭建spring源码阅读环境的文章就介绍到这了,更多相关idea搭建spring源码阅读环境内容请搜索好吧啦网以前的文章或继续浏览下面的相关文章希望大家以后多多支持好吧啦网!
相关文章: