• 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
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17

    在这篇文章中找到,需要修改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>
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    • 56
    • 57
    • 58
    • 59
    • 60
    • 61
    • 62
    • 63
    • 64
    • 65
    • 66
    • 67
    • 68
    • 69

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

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

  • 相关阅读:
    聊聊druid的源码的几个疑问
    使用MyBatis框架进行关系型数据库操作
    try catch finally代码块的作用
    Canal+Kafka实现MySQL与Redis数据同步(一)
    Git 版本控制:构建高效协作和开发流程的最佳实践
    (附源码)ssm高校选课系统 毕业设计 291627
    【异步与线程池】串讲&优化详情页加载
    vue 项目打包性能分析插件 webpack-bundle-analyzer
    java计算机毕业设计高校科研信息管理系统源码+mysql数据库+系统+lw文档+部署
    关于聚合根,领域事件的那点事---深入浅出理解DDD
  • 原文地址:https://blog.csdn.net/m0_67391270/article/details/126717213