gpt4 book ai didi

java - 下载springframework源码导入idea成功,创建测试模块,依赖不起作用

转载 作者:行者123 更新时间:2023-12-01 18:04:03 26 4
gpt4 key购买 nike

从github下载spring框架源代码。我创建测试模块。配置文件已修改,build.gradle:

plugins {
id 'java'
}

group 'io.spring.asciidoctor'
version '5.2.5.BUILD-SNAPSHOT'

sourceCompatibility = 1.8

dependencies {
compile(project(":spring-beans"))
compile(project(":spring-core"))
compile(project(":spring-context"))
compile(project(":spring-aop"))
testCompile group: 'junit', name: 'junit', version: '4.12'
}

然后我创建测试java源文件,使用@Autowired注释但它不起作用:

enter image description here

怎么了?

最佳答案

问题是您正在尝试编译相关项目,但这些项目不存在。您需要按组和版本来引用这些工件,类似于使用 JUnit 4.12 的方式。

dependencies {
compile group: 'org.springframework', name: 'spring-beans', version: '5.2.4.RELEASE'
compile group: 'org.springframework', name: 'spring-core', version: '5.2.4.RELEASE'
compile group: 'org.springframework', name: 'spring-context', version: '5.2.4.RELEASE'
compile group: 'org.springframework', name: 'spring-aop', version: '5.2.4.RELEASE'
}

关于java - 下载springframework源码导入idea成功,创建测试模块,依赖不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60589609/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com