我在IntelliJ中创建了一个Gradle项目,每次构建时都会遇到依赖项错误,总是类似于
GradleTest:test: Could not resolve org.junit
和
Gradle Daemon started in 2 s 100 ms
> Task :prepareKotlinBuildScriptModel UP-TO-DATE
Could not resolve: org.junit.jupiter:junit-jupiter-api:5.8.1
Could not resolve: org.junit.jupiter:junit-jupiter-engine:5.8.1
Could not resolve: org.junit.jupiter:junit-jupiter-api:5.8.1
Could not resolve: org.junit.jupiter:junit-jupiter-engine:5.8.1
BUILD SUCCESSFUL in 10s
我添加的每个依赖项都将遇到相同的错误,我没有处于脱机模式,我的jdk是正常的
我建筑。Gradle
plugins {
id 'java'
}
group 'org.example'
version '1.0-SNAPSHOT'
repositories {
mavenCentral()
}
dependencies {
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.1'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.1'
}
test {
useJUnitPlatform()
}
1条答案
按热度按时间uujelgoq1#
也许有点晚了,但(由于一些未知的原因),在我的情况下5. 8. 1版本是无法从IntelliJ,当我切换到5. 8. 2它的工作。