gpt4 book ai didi

java - Gradle 没有运行测试

转载 作者:塔克拉玛干 更新时间:2023-11-03 02:57:47 25 4
gpt4 key购买 nike

出于某种原因,gradle 没有运行我的测试。当我执行 gradle cleanTest test -i 我得到:

Skipping task ':compileJava' as it is up-to-date (took 0.262 secs).
:compileJava UP-TO-DATE
:compileJava (Thread[main,5,main]) completed. Took 0.266 secs.
:processResources (Thread[main,5,main]) started.
:processResources
Skipping task ':processResources' as it has no source files.
:processResources UP-TO-DATE
:processResources (Thread[main,5,main]) completed. Took 0.001 secs.
:classes (Thread[main,5,main]) started.
:classes
Skipping task ':classes' as it has no actions.
:classes UP-TO-DATE
:classes (Thread[main,5,main]) completed. Took 0.0 secs.
:compileTestJava (Thread[main,5,main]) started.
:compileTestJava
Skipping task ':compileTestJava' as it has no source files.
:compileTestJava UP-TO-DATE
:compileTestJava (Thread[main,5,main]) completed. Took 0.001 secs.
:processTestResources (Thread[main,5,main]) started.
:processTestResources
Skipping task ':processTestResources' as it is up-to-date (took 0.004 secs).
:processTestResources UP-TO-DATE
:processTestResources (Thread[main,5,main]) completed. Took 0.007 secs.
:testClasses (Thread[main,5,main]) started.
:testClasses
Skipping task ':testClasses' as it has no actions.
:testClasses UP-TO-DATE
:testClasses (Thread[main,5,main]) completed. Took 0.001 secs.
:test (Thread[main,5,main]) started.
:test
file or directory '/Users/jan/2014-2015-groep-05/VoPro/build/classes/test', not found
Skipping task ':test' as it has no source files.

我的测试在文件夹 ./test/ 中。这是我的 gradle 配置:

apply plugin: 'java'
apply plugin: 'eclipse'

test {
testLogging {
events "passed", "skipped", "failed", "standardOut", "standardError"
}
dependsOn 'cleanTest'
}

repositories {
mavenCentral()
}

dependencies {
testCompile("junit:junit")
}

sourceSets {
main {
java {
srcDir 'src'
srcDir 'test'
}
}
}

我似乎找不到问题所在。 Gradle 不识别任何测试,因为 test 和 cleanTest 始终是最新的,但是我确实将 test/添加到我的 sourceSets 中。

最佳答案

给使用 Junit5 的人的注意事项,我们需要包含以下内容以启用它 - 也就是说,默认情况下不启用运行 junit5 测试。

test {
useJUnitPlatform()
}

关于java - Gradle 没有运行测试,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29868724/

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