将 org.junit.platform.gradle.plugin
添加到构建中并从junit4 Gradle开始迁移后,所有内容都突破以下错误 .
一切都与老式跑步者一样好,但junit5测试不是 .
* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':server:junitPlatformTest'.
Caused by: org.gradle.process.internal.ExecException: A problem occurred starting process 'command 'C:\Program Files\Java\jdk1.8.0_131\bin\java.exe''
...
Caused by: java.io.IOException: CreateProcess error=206, The filename or extension is too long
Do I need to configure the junit5 test consumer somehow to deal with this sort of things? or maybe there is some uber jar handling those?
EDIT1
我怀疑这可能是类路径,我将使用所有junit模块生成一个uberjar .
EDIT2
查看源代码似乎是Junit插件为类路径添加了负载
// Note: the user's test runtime classpath must come first; otherwise, code
// instrumented by Clover in JUnit's build will be shadowed by JARs pulled in
// via the junitPlatform configuration... leading to zero code coverage for
// the respective modules.
classpath = project.sourceSets.test.runtimeClasspath + project.configurations.junitPlatform
我很好奇,如果我可以在项目评估之后消除这个配置 junitPlatform
,因为无论如何都要为编译代码添加所有JUnit依赖项,那么插件只是在顶部添加负载 . 我创建了一个项目,将所有Junit5库包装在一个人工制品中 .
EDIT3
我确实设法将所有木星文物打包成1以缩小cp,但我的类路径仍超过35k这有点奇怪
How does gradle run junit5 tests then? 好像它把所有其他项目中的所有传递都相关联,然后将它们添加到cp中,然后以错误= 206进行制动
2 回答
GRADLE 4.6 SUPPORTS JUNIT 5! 请记住,老式引擎需要与现在的木星版本相同编辑:16/03/2018
我已设法使用以下代码完成所有工作 .
它将生成一个带有清单的jar并将该jar放在类路径上 .
它没有使用任何仅作为javaExec任务运行平台的插件 .
此文件需要应用于要运行测试的项目 .
或者,现在您可以使用此插件执行上述操作,只需将其应用于具有太长类路径的项目 .
https://github.com/viswaramamoorthy/gradle-util-plugins
编辑
GRADLE 4.6 SUPPORTS JUNIT 5!
我无法使用
gradle-util-plugins
. Gradle找不到ConsoleLauncher
我在项目中包含了所有junit5依赖项 .