gpt4 book ai didi

java - TestNG 异常 :com/beust/jcommander/ParameterException

转载 作者:搜寻专家 更新时间:2023-11-01 03:31:28 30 4
gpt4 key购买 nike

当运行 mockito 测试用例时出现如下异常:

Exception in thread "main" java.lang.NoClassDefFoundError: com/beust/jcommander/ParameterException
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
at java.lang.Class.privateGetMethodRecursive(Unknown Source)
at java.lang.Class.getMethod0(Unknown Source)
at java.lang.Class.getMethod(Unknown Source)
at sun.launcher.LauncherHelper.validateMainClass(Unknown Source)
at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)
Caused by: java.lang.ClassNotFoundException: com.beust.jcommander.ParameterException
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 7 more

任何人都可以建议我解决这个问题我尝试了一些来自 stackoverflow 的解决方案但我没有得到解决方案

提前致谢

最佳答案

请确保在您的构建路径中包含 jcommander jar,例如对于 Maven,您可以使用以下代码来执行此操作:

<!-- https://mvnrepository.com/artifact/com.beust/jcommander -->
<dependency>
<groupId>com.beust</groupId>
<artifactId>jcommander</artifactId>
<version>1.27</version>
</dependency>

关于java - TestNG 异常 :com/beust/jcommander/ParameterException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52166212/

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