小编Dav*_*val的帖子

ID 为“junit-vintage”的 TestEngine 未能发现测试 - JUnitException:无法解析 junit 的版本:junit:4.13.2

我的 Gradle 配置和 JUnit 遇到了一个非常奇怪的问题,我尝试更新到 5.7+,但出现以下异常:

org/junit/jupiter/api/extension/ScriptEvaluationException
java.lang.NoClassDefFoundError: org/junit/jupiter/api/extension/ScriptEvaluationException
Run Code Online (Sandbox Code Playgroud)

顺便说一句,我的 Gradle 版本是 6.8.3。另一方面,这是我使用下面的当前配置得到的异常,我尝试了很多版本和库的组合,但似乎它们都不起作用:

Caused by: org.junit.platform.commons.JUnitException: TestEngine with ID 'junit-vintage' failed to discover tests
    at org.junit.platform.launcher.core.EngineDiscoveryOrchestrator.discoverEngineRoot(EngineDiscoveryOrchestrator.java:111)
    at org.junit.platform.launcher.core.EngineDiscoveryOrchestrator.discover(EngineDiscoveryOrchestrator.java:85)
    at org.junit.platform.launcher.core.DefaultLauncher.discover(DefaultLauncher.java:92)
    at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:75)
    at org.gradle.api.internal.tasks.testing.junitplatform.JUnitPlatformTestClassProcessor$CollectAllTestClassesExecutor.processAllTestClasses(JUnitPlatformTestClassProcessor.java:99)
    at org.gradle.api.internal.tasks.testing.junitplatform.JUnitPlatformTestClassProcessor$CollectAllTestClassesExecutor.access$000(JUnitPlatformTestClassProcessor.java:79)
    at org.gradle.api.internal.tasks.testing.junitplatform.JUnitPlatformTestClassProcessor.stop(JUnitPlatformTestClassProcessor.java:75)
    at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.stop(SuiteTestClassProcessor.java:61)
    ... 25 more
Caused by: org.junit.platform.commons.JUnitException: Failed to parse version of junit:junit: 4.13.2
    at org.junit.vintage.engine.JUnit4VersionCheck.parseVersion(JUnit4VersionCheck.java:54)
    at org.junit.vintage.engine.JUnit4VersionCheck.checkSupported(JUnit4VersionCheck.java:37)
    at org.junit.vintage.engine.JUnit4VersionCheck.checkSupported(JUnit4VersionCheck.java:32)
    at org.junit.vintage.engine.VintageTestEngine.discover(VintageTestEngine.java:62)
Run Code Online (Sandbox Code Playgroud)
plugins {
    id 'org.springframework.boot' version '2.4.5'
    id 'io.spring.dependency-management' version '1.0.11.RELEASE'
    id 'java'
    id 'com.palantir.docker' version '0.26.0'
}

group = …
Run Code Online (Sandbox Code Playgroud)

junit spring gradle spring-boot junit5

11
推荐指数
1
解决办法
3万
查看次数

zsh:找不到命令:mockgen - golang 1.18 - macOS 蒙特雷

我是新来的。目前我在 macOS 中使用 zsh 终端,安装 go mock 时只需按照此处指出的说明进行操作:https://github.com/golang/mock。然而,当尝试执行mockgen命令时,我不断看到zsh: command not found: mockgen并且在终端中导航到我的终端时$GOPATH/bin我看到mockgen在那里,所以我不知道是否还需要任何其他东西。

在此输入图像描述

这些是我在 /.zshrc 文件中配置的变量:

#GO path
export GOPATH="$HOME/Documents/study_projects/go"
export GOBINPATH="$GOPATH/bin"
Run Code Online (Sandbox Code Playgroud)

Idk ifGOBINPATH也是要导出到 PATH 的变量的正确名称,aso 在https://github.com/golang/mock (mockgen/gomock) 安装说明$GOPATH/bin中指出。你们中有人知道这里还需要什么吗?我是否需要额外的配置才能让这个mockgen命令与zsh一起使用?

谢谢你!

zsh go gomock

8
推荐指数
2
解决办法
2万
查看次数

标签 统计

go ×1

gomock ×1

gradle ×1

junit ×1

junit5 ×1

spring ×1

spring-boot ×1

zsh ×1