1.根据idea查看gradle的版本,在idea的plugins目录下
2.Spring源码对应的gradle版本号
gradle/wrapper/gradle-wrapper.properties
3.下载gradle
3.1配置加速,在gradle根目录:\init.d\下,新建一个:init.gradle 文件,
allprojects{
repositories {
def REPOSITORY_URL = 'http://maven.aliyun.com/nexus/content/groups/public/'
all { ArtifactRepository repo ->
def url = repo.url.toString()
if ((repo instanceof MavenArtifactRepository) && (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 }
}}
3.2 build.gradle 文件配置
3.3 settings.gradle 文件配置
4.下载Spring源码后在项目下可以看到 import-into-idea.md 文件
5. chmod +x gradlew
sudo chown -R $(whoami) /usr/local
Password:
chown: /usr/local: Operation not permitted
6 ./gradlew :spring-oxm:compileTestJava
7.一般 IDEA 都有提示添加到 Gradle 中,如果没有,可以通过 View -> Tool Windows -> Gradle ,然后在 Gradle Project 面板进行添加,点击刷新按钮就可以下载依赖包了。
8.详见gitee
两台电脑互用:.错误: 程序包org.springframework.aop.target不存在:删掉 .gitigone 中的 target!这个配置决定git中拉代码推代码会自动忽略掉target这个包,spring源码仓库是有target这个包的
网络连接问题:
Plugin [id: 'org.jetbrains.kotlin.jvm', version: '1.2.71', apply: false] was not found in any of the following sources:
- Gradle Core Plugins (plugin is not in 'org.gradle' namespace)
- Plugin Repositories (could not resolve plugin artifact 'org.jetbrains.kotlin.jvm:org.jetbrains.kotlin.jvm.gradle.plugin:1.2.71')
Searched in the following repositories:
maven(https://maven.aliyun.com/repository/public)
Gradle Central Plugin Repository
maven2(https://repo.spring.io/plugins-release)
Open File