GradleTest:测试:无法解析org.junit和任何依赖关系

de90aj5v  于 2022-11-11  发布在  其他
关注(0)|答案(1)|浏览(271)

我在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()
}
uujelgoq

uujelgoq1#

也许有点晚了,但(由于一些未知的原因),在我的情况下5. 8. 1版本是无法从IntelliJ,当我切换到5. 8. 2它的工作。

相关问题