上篇文章中概述了 Ant windows 环境的基本配置,此文讲述在初次使用的过程中遇到的问题。

今天通过 ant 执行 TestNG 测试用例时,执行报错,相应的错误信息如下所示:

Buildfile: D:\DevTool\autoUI_64\workspace\ReportNG\build.xml
init:
compile:
start_server_and_run_tests:
init:
compile:
run_tests:
[delete] Deleting directory D:\DevTool\autoUI_64\workspace\ReportNG\test-output
[mkdir] Created dir: D:\DevTool\autoUI_64\workspace\ReportNG\test-output
[testng] java.lang.NoClassDefFoundError: com/beust/jcommander/ParameterException
[testng] at java.lang.Class.getDeclaredMethods0(Native Method)
[testng] at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
[testng] at java.lang.Class.privateGetMethodRecursive(Class.java:3048)
[testng] at java.lang.Class.getMethod0(Class.java:3018)
[testng] at java.lang.Class.getMethod(Class.java:1784)
[testng] at sun.launcher.LauncherHelper.validateMainClass(LauncherHelper.java:544)
[testng] at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:526)
[testng] Caused by: java.lang.ClassNotFoundException: com.beust.jcommander.ParameterException
[testng] at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
[testng] at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
[testng] at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
[testng] at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
[testng] ... 7 more
[testng] Error: A JNI error has occurred, please check your installation and try again BUILD FAILED
D:\DevTool\autoUI_64\workspace\ReportNG\build.xml:24: The following error occurred while executing this line:
D:\DevTool\autoUI_64\workspace\ReportNG\build.xml:31: The tests failed. Total time: 832 milliseconds

究其原因是因为缺失了 jcommander.jar ,加入 jcommander.jar 引用后,问题圆满解决。

jcommander.jar 可在 Maven Repository 下载

至此, Ant学习-002-ant 执行 TestNG 测试用例时 [testng] java.lang.NoClassDefFoundError: com/beust/jcommander/ParameterException 解决方案 顺利完结,希望此文能够给初学 ant 的您一份参考。

最后,非常感谢亲的驻足,希望此文能对亲有所帮助。热烈欢迎亲一起探讨,共同进步。非常感谢! ^_^

Ant学习-002-ant 执行 TestNG 测试用例时 [testng] java.lang.NoClassDefFoundError: com/beust/jcommander/ParameterException 解决方案的更多相关文章

  1. MapReduce运行时出现java.lang.NoClassDefFoundError

    最近在编写MapReduce程序时遇到了一个错误,错误提示信息为: Error: java.lang.ClassNotFoundException: org.apache.hadoop.hbase.H ...

  2. 用Eclipse做Android开发时出现java.lang.NoClassDefFoundError问题

    之前有遇到过这个问题,后来解决了,今天又遇到了,但是忘了当时是怎么解决的,费了好长时间,终于又找回解决的方法,现在记录下来,以防以后又遇到. 这个错误出现在我的某一个Activity,但是我反复确认了 ...

  3. Error:gradle-resources-test:thymeleaf-in-action.main: java.lang.NoClassDefFoundError: org/apache/tools/ant/util/ReaderInputStream

    目录 Error:gradle-resources-test:thymeleaf-in-action.main: java.lang.NoClassDefFoundError: org/apache/ ...

  4. java -jar 执行jar包出现 java.lang.NoClassDefFoundError

    我用idea工具将自己开发java程序打成一个可执行的jar包,当然用eclipse或者直接用jar命令行都无所谓,本质都是将程序归档到一个压缩包,并附带一个说明清单文件. 打jar的操作其实很简单, ...

  5. 【异常】idea执行Main方法出现 Exception in thread "main" java.lang.NoClassDefFoundError: javax/servlet/http/HttpServletRequest

    一.异常复现步骤 1)首先得是一个Spring MVC项目 注:Spring Boot项目有内置的web 容器,不会出现该问题 2)main方法存在于使用HttpServletRequest类的类中 ...

  6. Spring配置c3p0数据源时出错报:java.lang.NoClassDefFoundError: com/mchange/v2/ser/Indirector

    今天在使用Spring配置c3p0数据源时,使用的数据库是mysql,服务器是tomcat,运行时报了一个 java.lang.NoClassDefFoundError: com/mchange/v2 ...

  7. Java 控制台执行带自定义包定义的类,出现“Exception in thread "main" java.lang.NoClassDefFoundError: ConnectSQLServer (wrong name: sine/ConnectSQLServer)”

    1.先说明一下代码实现:自定义package sine, 源代码保存路径为:E:\JSP\HibernateDemo\HibernateDemoProject\src\sine\ConnectSQLS ...

  8. android netty5.0 编译时 java.lang.NoClassDefFoundError: io.netty.channel.nio.NioEventLoopGroup

    android netty5.0 编译时 java.lang.NoClassDefFoundError: io.netty.channel.nio.NioEventLoopGroup 复制netty包 ...

  9. Eclipse下执行main函数报java.lang.NoClassDefFoundError的解决

    今天执行eclipse下的一个java类,无论run还是debug,都报java.lang.NoClassDefFoundError.而且把main中函数都注释掉,执行还是报一样的错. 检查了一下这个 ...

随机推荐

  1. 【POJ】1062 昂贵的聘礼(spfa)

    http://poj.org/problem?id=1062 此题一开始果断想到暴力.. 但是n<=100果断不行. 一看题解,噗!最短路... 构图很巧妙. 每一个物品对应的所需物品相当于一个 ...

  2. c语言字符串操作,及常用函数

    一,字符串操作 1 . strcpy : 拷贝 char *stpcpy(char *destin, char *source); 2 . strcat :  拼接 char *strcat(char ...

  3. 20145302张薇《Java程序设计》实验三报告

    20145302张薇<Java程序设计>实验三:敏捷开发与XP实践 实验内容 使用git上传代码 使用git实现代码开发实践 实现代码的重载 使用git上传代码 git init git ...

  4. sqlserver常用日期、时间函数和格式

    Sql Server中常用的日期与时间函数1.  当前系统日期.时间    select getdate() 2. dateadd  在向指定日期加上一段时间的基础上,返回新的 datetime 值  ...

  5. replaceCharactersInRange

    NSString 替换字符串中某一位置的文字  replaceCharactersInRange NSString 替换字符串中某一位置的文字 - (void)viewDidLoad { NSMuta ...

  6. [转].net自定义configSections的5个示例

    本文转自:http://www.yongfa365.com/item/configuration-configSections-SingleTagSectionHandler-DictionarySe ...

  7. 19. 求平方根序列前N项和

    求平方根序列前N项和 #include <stdio.h> #include <math.h> int main() { int i, n; double item, sum; ...

  8. Redis 笔记与总结2 String 类型和 Hash 类型

    Linux 版本信息: cat /etc/issue 或cat /etc/redhat-release(Linux查看版本当前操作系统发行版信息) CentOS release 6.6 (Final) ...

  9. 使用 PHP 限制下载速度

    使用 PHP 限制下载速度 [来源] 达内    [编辑] 达内   [时间]2012-12-12 经常遇到一个问题,那就是有人再办公室下载东西,影响大家上网.办公.同样的问题,要是出现在了服务器上面 ...

  10. XPath学习:parent,child

    XPath 是一门在 XML 文档中查找信息的语言.XPath 可用来在 XML 文档中对元素和属性进行遍历. XPath 是 W3C XSLT 标准的主要元素,并且 XQuery 和 XPointe ...