0
点赞
收藏
分享

微信扫一扫

mac版本Spring5.0源码环境搭建

  1. 下载spring5.0版本代码image.png 链接是:https://github.com/spring-projects/spring-framework.git
  2. 装gradle,使用的版本是8.3版本 链接是:https://gradle.org/next-steps/?version=8.3&format=bin
  3. 有错误提示:image.png/Users/wangyu/work/code/spring-framework/buildSrc/src/main/java/org/springframework/build/KotlinConventions.java:44: 错误: 找不到符号 freeCompilerArgs.addAll(List.of("-Xsuppress-version-warnings", "-Xjsr305=strict", "-opt-in=kotlin.RequiresOptIn")); ^ 符号: 方法 of(java.lang.String,java.lang.String,java.lang.String) 位置: 接口 java.util.List

解决方案:改为JDK17image.png 4. 再次执行build。提示报错 Could not resolve all dependencies for configuration ':framework-docs:compileClasspath'. Failed to calculate the value of task ':spring-core:compileJava21Java' property 'javaCompiler'. No matching toolchains found for requested specification: {languageVersion=21, vendor=any, implementation=vendor-specific} for MAC_OS on x86_64. No locally installed toolchains match and toolchain download repositories have not been configured. image.png 看提示是说spring-core里面languageVersion不匹配,继续解决这个问题image.png 5. ok,继续build成功image.png 6. 验证源码环境 7. 加入依赖后开始执行依赖,报错 16:59:46: Executing 'dependencies'...

Task :buildSrc:compileJava UP-TO-DATE Task :buildSrc:compileGroovy NO-SOURCE Task :buildSrc:pluginDescriptors UP-TO-DATE Task :buildSrc:processResources UP-TO-DATE Task :buildSrc:classes UP-TO-DATE Task :buildSrc:jar UP-TO-DATE

FAILURE: Build completed with 2 failures.

1: Task failed with an exception.

  • Where: Build file '/Users/wangyu/work/code/spring-framework/spring-learning/build.gradle' line: 17

  • What went wrong: A problem occurred evaluating project ':spring-learning'.

Could not find method compile() for arguments [project ':spring-aop'] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

  • Try:

Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Get more help at https://help.gradle.org. ==============================================================================

2: Task failed with an exception.

  • Where: Build file '/Users/wangyu/work/code/spring-framework/spring-learning/build.gradle' line: 17

  • What went wrong: A problem occurred evaluating project ':spring-learning'.

Could not find method compile() for arguments [project ':spring-aop'] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

  • Try:

Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Get more help at https://help.gradle.org. ==============================================================================

BUILD FAILED in 2s

Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

For more on this, please refer to https://docs.gradle.org/8.3/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation. 4 actionable tasks: 4 up-to-date

A build scan was not published as you have not authenticated with server 'ge.spring.io'. For more information, please see https://gradle.com/help/gradle-authenticating-with-gradle-enterprise. 16:59:50: Execution finished 'dependencies'.

这个是说依赖识别不了,修改依赖的形式: 正确的形式应该这样写: image.png

有问题的之前的看案例的写法是这样写的

dependencies {
    compile(project(":spring-aop"))
    compile(project(":spring-beans"))
    compile(project(":spring-context"))
    compile(project(":spring-core"))
    compile(project(":spring-expression"))
}

可以通过图片看到这个是灰色的,说明方法没找到。 8. ok,成功

举报

相关推荐

0 条评论