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

扫码关注公众号:Java 技术驿站

发送:vip
将链接复制到本浏览器,永久解锁本站全部文章

【公众号:Java 技术驿站】 【加作者微信交流技术,拉技术群】
免费领取 2000+ 道 Java 面试题

最近在看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

2019102020022\_1.png

在这篇文章中找到,需要修改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文件,

修改之

找到目录下的文件

2019102020022\_2.png

打开文件修改。

2019102020022\_3.png

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

    C:\burns\spring-framework-master\spring-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:\burns\spring-framework-master\spring-tx>

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

2019102020022\_4.png

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

2019102020022\_5.png

赞(0) 打赏
版权归原创作者所有,任何形式的转载请联系博主:daming_90:Java 技术驿站 » gradle编译spring源码过程问题整理

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏