gradle编译spring源码过程问题整理

最近在看spring boot ,发现好多是spring中的技术或概念,于是找了一本书《Spring源码深度解析.pdf》,开始学习下源码是从git上下的,先把https://github.com/spring-projects/spring-framework 克隆成我的项目,然后为了节省时间,下载zip的方式下载到本地,接下来就是导入到开发工具eclipse了,

在cmd执行:gradle cleanidea eclipse时,报如下错误:

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'spring'.
> Could not resolve all dependencies for configuration ':classpath'.
   > Could not resolve org.springframework.build.gradle:propdeps-plugin:0.0.7.
     Required by:
         :spring:4.2.3.BUILD-SNAPSHOT
      > Could not resolve org.springframework.build.gradle:propdeps-plugin:0.0.7.
         > Could not get resource 'https://repo.spring.io/plugins-release/org/springframework/build/gradle/propdeps-plugin/0.0.7/propdeps-plugin-0.0.7.pom'.
            > Could not GET 'https://repo.spring.io/plugins-release/org/springframework/build/gradle/propdeps-plugin/0.0.7/propdeps-plugin-0.0.7.pom'.
               > Connect to repo.spring.io:443 [repo.spring.io/35.186.232.213] failed: Connection timed out: connect

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

在这篇文章中找到,需要修改maven仓库:https://www.oschina.net/question/2380402_2181441

**修改maven仓库
**

repositories { maven { url “http://repo.springsource.org/plugins-release” } }

以为是要修改maven的配置文件,结果找了半天,在https://blog.csdn.net/javandroid/article/details/75094335?locationNum=1&fps=1文章中发现是要修改项目下的build.gradle文件,

修改之

找到目录下的文件

打开文件修改。

修改完文件,保存,再执行命令,则发现构建成功,

C:urnsspring-framework-masterspring-tx>gradle cleanidea eclipse
:buildSrc:clean
:buildSrc:compileJava UP-TO-DATE
:buildSrc:compileGroovy
:buildSrc:processResources
:buildSrc:classes
:buildSrc:jar
:buildSrc:assemble
:buildSrc:compileTestJava UP-TO-DATE
:buildSrc:compileTestGroovy UP-TO-DATE
:buildSrc:processTestResources UP-TO-DATE
:buildSrc:testClasses UP-TO-DATE
:buildSrc:test UP-TO-DATE
:buildSrc:check UP-TO-DATE
:buildSrc:build
Download https://repo.spring.io/plugins-release/org/apache/xmlgraphics/fop/0.95-1/fop-0.95-1.jar
Download https://repo.spring.io/plugins-release/org/apache/avalon/framework/avalon-framework-api/4.3.1/avalon-framework-api-4.3.1.jar
Download https://repo.spring.io/plugins-release/org/apache/xmlgraphics/batik-util/1.7/batik-util-1.7.jar
Download https://repo.spring.io/plugins-release/org/apache/xmlgraphics/batik-svg-dom/1.7/batik-svg-dom-1.7.jar
Download https://repo.spring.io/plugins-release/net/sf/docbook/docbook-xsl/1.78.1/docbook-xsl-1.78.1-resources.zip
Download https://repo.spring.io/plugins-release/net/sf/docbook/docbook-xml/5.0/docbook-xml-5.0-xsd-resources.zip
Download https://repo.spring.io/plugins-release/net/sf/xslthl/xslthl/2.0.1/xslthl-2.0.1.jar
Download https://repo.spring.io/plugins-release/org/apache/xerces/resolver/2.9.1/resolver-2.9.1.jar
Download https://repo.spring.io/plugins-release/net/sf/docbook/docbook-xsl-saxon/1.0.0/docbook-xsl-saxon-1.0.0.jar
Download https://repo.spring.io/plugins-release/org/apache/xmlgraphics/batik-gvt/1.7/batik-gvt-1.7.jar
Download https://repo.spring.io/plugins-release/org/apache/xmlgraphics/batik-parser/1.7/batik-parser-1.7.jar
Download https://repo.spring.io/plugins-release/org/apache/xmlgraphics/batik-script/1.7/batik-script-1.7.jar
Download https://repo.spring.io/plugins-release/org/apache/xmlgraphics/batik-transcoder/1.7/batik-transcoder-1.7.jar
Download https://repo.spring.io/plugins-release/org/apache/xmlgraphics/batik-extension/1.7/batik-extension-1.7.jar
Download https://repo.spring.io/plugins-release/commons-io/commons-io/1.3.1/commons-io-1.3.1.jar
Download https://repo.spring.io/plugins-release/org/apache/avalon/framework/avalon-framework-impl/4.3.1/avalon-framework-impl-4.3.1.jar
Download https://repo.spring.io/plugins-release/org/apache/xmlgraphics/batik-js/1.7/batik-js-1.7.jar
Download https://repo.spring.io/plugins-release/org/apache/xmlgraphics/batik-svggen/1.7/batik-svggen-1.7.jar
Download https://repo.spring.io/plugins-release/org/apache/xmlgraphics/xmlgraphics-commons/1.3.1/xmlgraphics-commons-1.3.1.jar
The 'sonar-runner' plugin has been deprecated and is scheduled to be removed in Gradle 3.0. please use the official plugin from SonarQube (http://docs.sonarqube.org/display/SONAR/Analyzing+with+Gradle).
:spring-tx:cleanIdeaModule UP-TO-DATE
:spring-tx:cleanIdea UP-TO-DATE
:spring-tx:eclipseClasspath
Download https://repo.spring.io/libs-release/net/java/jvnet-parent/3/jvnet-parent-3.pom
Download https://repo.spring.io/libs-release/javax/resource/connector-api/1.5/connector-api-1.5.pom
Download https://repo.spring.io/libs-release/com/ibm/websphere/uow/6.0.2.17/uow-6.0.2.17.pom
Download https://repo.spring.io/libs-release/org/hamcrest/hamcrest-all/1.3/hamcrest-all-1.3.pom
Download https://repo.spring.io/libs-release/org/aspectj/aspectjweaver/1.8.7/aspectjweaver-1.8.7.pom
Download https://repo.spring.io/libs-release/org/eclipse/persistence/javax.persistence/2.0.0/javax.persistence-2.0.0.pom
Download https://repo.spring.io/libs-release/org/apache/apache/13/apache-13.pom
Download https://repo.spring.io/libs-release/javax/resource/connector-api/1.5/connector-api-1.5.jar
Download https://repo.spring.io/libs-release/javax/ejb/ejb-api/3.0/ejb-api-3.0.jar
Download https://repo.spring.io/libs-release/com/ibm/websphere/uow/6.0.2.17/uow-6.0.2.17.jar
Download https://repo.spring.io/libs-release/org/hamcrest/hamcrest-all/1.3/hamcrest-all-1.3.jar
Download https://repo.spring.io/libs-release/org/aspectj/aspectjweaver/1.8.7/aspectjweaver-1.8.7.jar
Download https://repo.spring.io/libs-release/javax/transaction/javax.transaction-api/1.2/javax.transaction-api-1.2-sources.jar
Download https://repo.spring.io/libs-release/javax/resource/connector-api/1.5/connector-api-1.5-sources.jar
Download https://repo.spring.io/libs-release/javax/ejb/ejb-api/3.0/ejb-api-3.0-sources.jar
Download https://repo.spring.io/libs-release/org/mockito/mockito-core/1.10.19/mockito-core-1.10.19-sources.jar
Download https://repo.spring.io/libs-release/org/hamcrest/hamcrest-all/1.3/hamcrest-all-1.3-sources.jar
Download https://repo.spring.io/libs-release/org/aspectj/aspectjweaver/1.8.7/aspectjweaver-1.8.7-sources.jar
Download https://repo.spring.io/libs-release/org/eclipse/persistence/javax.persistence/2.0.0/javax.persistence-2.0.0-sources.jar
Download https://repo.spring.io/libs-release/org/objenesis/objenesis/2.1/objenesis-2.1-sources.jar
:spring-tx:eclipseJdtPrepare
:spring-tx:eclipseJdt
:spring-tx:eclipseProject
:spring-tx:eclipseSettings
:spring-tx:eclipseWstComponent
:spring-tx:eclipse

BUILD SUCCESSFUL

Total time: 1 mins 55.201 secs
C:urnsspring-framework-masterspring-tx>

在观察spring-tx目录下就变成eclipse可以导入的带.project和.classpath文件的项目目录了。

导入eclipse,剩下的项目感叹号的问题就继续阅读pdf解决吧。

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值