When I execute my test with testng.xml then it runs fine, but when I execute with pom.xml then got the ERROR:
[ERROR] java.lang.UnsupportedClassVersionError: org/testng/ITestListener has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0
My Java version: 1.8.0_333, and Apache Maven 3.8.4.
How can I resolve this?
If any one knows the solution please help me.
As noted in the comments, the TestNG website says :
Requirements
TestNG Upto v7.5: JDK 8 or higher.
TestNG v7.6.0 and above: JDK 11 or higher.
So the possible solutions are:
Use an older version of TestNG than v7.6.0 if you want to use Java 8 as your development platform. The TestNG version will probably be in your project's POM file.
Upgrade your development platform to Java 11 or later.
If you are feeling brave 1 , attempt to backport the version of TestNG (>= v7.6.0) that you are using to run on Java 8 (or older).
1 - This could be trivial or complicated. You won't know until you try it.
This happened for me, when I copied one maven, testng project from another project. I was just missing adding TestNG external library in Eclipse, which can be done with below steps:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.