【发布时间】:2015-11-19 18:26:44
【问题描述】:
我正在使用 linux 机器(ubuntu 14)。我的项目是带有 testng 框架的 Maven 项目。在这里,我尝试从命令提示符运行 testng.xml,以便我可以在 jenkins 中进行配置。
project location : /home/subhash/workspace/myproject
class path is : /home/subhash/workspace/myproject/bin
testng jar locattion is: /home/subhash/.m2/repository/org/testng/testng/6.9.4/testng-6.9.4.jar"
suite location is : /home/subhash/workspace/suites/src/test/resources/testng.xml
hence i executed the following command from command prompt from the location.
/home/subhash/workspace/myproject/bin$
$ java -cp ".:../lib/*:/home/subhash/.m2/repository/org/testng/testng/6.9.4/testng-6.9.4.jar" org.testng.TestNG /home/subhash/workspace/suites/src/test/resources/testng.xml
我得到了以下异常:
Exception in thread "main" java.lang.NoClassDefFoundError: com/beust/jcommander/ParameterException
因此我在 pom.xml 中添加了如下依赖项。
<dependency>
<groupId>com.beust</groupId>
<artifactId>jcommander</artifactId>
<version>1.48</version>
构建它。它是成功的。 我再次运行上述命令来运行 testng.xml,但仍然显示相同的异常。
请帮助我解决这个问题。
提前致谢。 子哈希。
【问题讨论】: