Suddenly can't run TestNG tests from ant ([testng] Caused by: java.lang.ClassNotFoundException: com.beust.jcommander.ParameterException)

后端 未结 7 1440
走了就别回头了
走了就别回头了 2020-12-01 21:29

I am using ant and TestNG 6.1.1, and I had my tests working just fine yesterday. Today when I try to run the tests I get a NoClassDefFoundError involving com/beust/jcommand

相关标签:
7条回答
  • If you're using ant, JCommander should be inside testng.jar, so I'm thinking your testng.jar file might be corrupt.

    0 讨论(0)
  • 2020-12-01 22:00

    May be testng.jar is not in classpath.

    0 讨论(0)
  • 2020-12-01 22:02

    jcommander.jar (e.g. jcommander-1.29.jar) should be present on fileset directory which is mentioned at build.xml

    You can download it from: http://mvnrepository.com/artifact/com.beust/jcommander/1.27

    OR,

    JCommander should be inside testng.jar during using ant. Your testng.jar file might be corrupted, so please replace old testng.jar by new one.

    0 讨论(0)
  • 2020-12-01 22:05

    If your using Maven try adding this to your pom.xml

    <dependency>
      <groupId>com.beust</groupId>
      <artifactId>jcommander</artifactId>
      <version>1.30</version>
    </dependency>
    
    0 讨论(0)
  • 2020-12-01 22:05

    The problem here is that certain versions of the testNG jar do not have the jcommander jar code inside of them. As a result, you have to add the classpath to the Jcommander jar separately.

    Adding the Jcommander jar to your classpath when you run it will fix the problem, hopefully

    0 讨论(0)
  • 2020-12-01 22:13

    My ant start working when I have downloaded jcommandar jar from Maven repository and added it in my jar file

    But This problem Starts coming with testng 6.8.5 version

    0 讨论(0)
提交回复
热议问题