zoukankan      html  css  js  c++  java
  • Ant学习-002-ant 执行 TestNG 测试用例时 [testng] java.lang.NoClassDefFoundError: com/beust/jcommander/ParameterException 解决方案

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

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

    Buildfile: D:DevToolautoUI_64workspaceReportNGuild.xml
    init:
    compile:
    start_server_and_run_tests:
    init:
    compile:
    run_tests:
       [delete] Deleting directory D:DevToolautoUI_64workspaceReportNG	est-output
        [mkdir] Created dir: D:DevToolautoUI_64workspaceReportNG	est-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:DevToolautoUI_64workspaceReportNGuild.xml:24: The following error occurred while executing this line:
    D:DevToolautoUI_64workspaceReportNGuild.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 的您一份参考。

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

     

  • 相关阅读:
    Android——inflate 将一个xml中定义的布局找出来
    Android——显示单位px和dip以及sp的区别
    StrategyPattern (策略模式)
    Flyweight(享元模式)
    ComponentPattern (组合模式)
    Java子类属性继承父类属性
    BridgePattern(桥接模式)
    FacadePattern(门面模式)
    装饰者模式,适配器模式,代理模式区别
    DecoratorPattern(装饰器模式)
  • 原文地址:https://www.cnblogs.com/fengpingfan/p/4705556.html
Copyright © 2011-2022 走看看