email2vimalraj / CucumberExtentReporter

A plugin to generate the cucumber jvm custom html report using ExtentsReport
http://www.vimalselvam.com/cucumber-extent-reporter/
MIT License
58 stars 75 forks source link

getting gherkin/formatter/Formatter #59

Open Ajay0427 opened 7 years ago

Ajay0427 commented 7 years ago

java.lang.NoClassDefFoundError: gherkin/formatter/Formatter at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:763) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) at java.net.URLClassLoader.defineClass(URLClassLoader.java:467) at java.net.URLClassLoader.access$100(URLClassLoader.java:73) at java.net.URLClassLoader$1.run(URLClassLoader.java:368) at java.net.URLClassLoader$1.run(URLClassLoader.java:362) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:361) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) at cucumber.runtime.formatter.PluginFactory$1.(PluginFactory.java:53) at cucumber.runtime.formatter.PluginFactory.(PluginFactory.java:52) at cucumber.runtime.RuntimeOptionsFactory.addPlugins(RuntimeOptionsFactory.java:90) at cucumber.runtime.RuntimeOptionsFactory.buildArgsFromOptions(RuntimeOptionsFactory.java:37) at cucumber.runtime.RuntimeOptionsFactory.create(RuntimeOptionsFactory.java:24) at cucumber.api.junit.Cucumber.(Cucumber.java:56) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:104) at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:86) at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59) at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:26) at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59) at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:33) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createUnfilteredTest(JUnit4TestLoader.java:84) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createTest(JUnit4TestLoader.java:70) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.loadTests(JUnit4TestLoader.java:43) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:444) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:678) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192) Caused by: java.lang.ClassNotFoundException: gherkin.formatter.Formatter at java.net.URLClassLoader.findClass(URLClassLoader.java:381) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ... 35 more

email2vimalraj commented 7 years ago

Do you have the cucumber and gherkin libraries added in your dependencies?

Ajay0427 commented 7 years ago

Hello Vimal,

Yes, I have both the libraries in dependencies Cucumber Java and junit -1.2.5 Gherkin -2.12.2

Regards, Ajay Jaiswal

On Sun, 6 Aug 2017 at 8:23 AM, VimalRaj Selvam notifications@github.com wrote:

Do you have the cucumber and gherkin libraries added in your dependencies?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/email2vimalraj/CucumberExtentReporter/issues/59#issuecomment-320482212, or mute the thread https://github.com/notifications/unsubscribe-auth/AT0_u0oK9HBo2VVY45LQTlxPbpUxC7qPks5sVSqygaJpZM4Opmxb .

adarshkv commented 7 years ago

Hi Vimal,

I am also facing this same issue, do we have a solution for this ? Do I need to update the gherkin version ? Please do let me know.

Thanks and Regards, Adarsh

lewisob commented 7 years ago

I am also facing this issue.

Is there a fix coming?

srirambk commented 7 years ago

I am also facing the same problem. I am using cucumber-java-1.25.jar, junit-4.12.jar, gherking-2.12.2.jar

Can someone help me out?

nrsawalw commented 6 years ago

I am also facing same issue. cucumber-java-1.25.jar, junit-4.12.jar, gherkin-2.12.2.jar is there any fix?

email2vimalraj commented 6 years ago

I'll look into it, but no timelines for now. I appreciate PR if you're interested in it.

On 24-Dec-2017 10:01 AM, "nrsawalw" notifications@github.com wrote:

I am also facing same issue. cucumber-java-1.25.jar, junit-4.12.jar, gherkin-2.12.2.jar is there any fix?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/email2vimalraj/CucumberExtentReporter/issues/59#issuecomment-353764847, or mute the thread https://github.com/notifications/unsubscribe-auth/ABKI3iCsM8lVI0FsfNHU9Ow5HwBjenE4ks5tDdOVgaJpZM4Opmxb .

nrsawalw commented 6 years ago

Hi Vimal,

Thanks for reply, please look into this issue and let me know if you required any details.

email2vimalraj commented 6 years ago

Can anyone of you please post the sample project with the pom file? I'm unable to reproduce this issue.

it-shivani commented 6 years ago

I am facing similar issue with TestNG

charlenezheng commented 6 years ago

Hi, I was facing the same issue. The following is the step of how I fixed it: I checked the gherkin version in my pom.xml and Referenced Libraries -> gherkin/formatter/Formatter was there. so the class could be found while not. I guess it may be difficult to solve this issue from pom...therefore I upload that jar file directly to the library...then it fixed finally and work well. Hope it is useful for you.

it-shivani commented 6 years ago

Do you mean you explicitly uploaded jars related to extent reports? I tried that but still getting the same null pointer exception.

smsmandale commented 6 years ago

Anyone got any solution for this error?

mksmanyam commented 6 years ago

I have faced the similar issue today... when i googled i found the problem is with the .m2 repository. Steps:

  1. go to .m2\repository\info\cukes\
  2. delete the gherkin folder from this directory. (Seems to be corrupted)
  3. Now set gherkin 2.12.2 version in the pom.xml and save and run your test.

It worked for me. Hope it is useful for you....

poojagaut commented 6 years ago

Thanks mksmanyam your suggestion finally worked for me

kathyrollo commented 6 years ago

I can confirm this issue still exists as of 3.1.0. As @mksmanyam mentioned, a workaround is to explicitly include gherkin in your pom.xml:

<!-- https://mvnrepository.com/artifact/info.cukes/gherkin -->
<dependency>
    <groupId>info.cukes</groupId>
    <artifactId>gherkin</artifactId>
    <version>2.12.2</version>
    <scope>provided</scope>
</dependency>
kathyrollo commented 6 years ago

Hi @email2vimalraj ,

Feel free to pull this branch: https://github.com/kathyrollo/jcucumberng-framework/tree/issue-42

I have placed the workaround in that branch. If you remove gherkin from the pom, you will be able to replicate this issue.

kudarichetan commented 6 years ago

Thanks mksmanyam for the help.

tapanagkumar commented 6 years ago

I can confirm this issue still exists as of 3.1.0. As @mksmanyam mentioned, a workaround is to explicitly include gherkin in your pom.xml:

<!-- https://mvnrepository.com/artifact/info.cukes/gherkin -->
<dependency>
  <groupId>info.cukes</groupId>
  <artifactId>gherkin</artifactId>
  <version>2.12.2</version>
  <scope>provided</scope>
</dependency>

Resolved, Thankyou

Udhay1316 commented 6 years ago

2.12.2

I did the same but still I am getting below error

cucumber.runtime.CucumberException: Couldn't load plugin class: com.vimalselvam.cucumber.listener.ExtentCucumberFormatter. It does not implement cucumber.api.Plugin

I am using below dependencies along with gherkin dependency

<dependency>
        <groupId>io.cucumber</groupId>
        <artifactId>cucumber-spring</artifactId>
        <version>2.3.1</version>
    </dependency>
    <dependency>
        <groupId>io.cucumber</groupId>
        <artifactId>cucumber-java8</artifactId>
        <version>2.3.1</version>
    </dependency>

Please help me to understand what dependencies you have

Thanks in advance..!!

ghost commented 6 years ago

I m also getting the same issue on cucumber version: 2.4.0

cucumber.runtime.CucumberException: Couldn't load plugin class:

@mksmanyam / @kathyrollo: How did you fix this issue? I tried those steps as well, however, did not get any success

I provided below dependency in my POM.xml file

info.cukes gherkin 2.12.2 provided

I tried to manually too to place proper JAR file.

Could you please help me on this

vamc264 commented 6 years ago

2.12.2

I did the same but still I am getting below error

cucumber.runtime.CucumberException: Couldn't load plugin class: com.vimalselvam.cucumber.listener.ExtentCucumberFormatter. It does not implement cucumber.api.Plugin

I am using below dependencies along with gherkin dependency

<dependency>
        <groupId>io.cucumber</groupId>
        <artifactId>cucumber-spring</artifactId>
        <version>2.3.1</version>
    </dependency>
    <dependency>
        <groupId>io.cucumber</groupId>
        <artifactId>cucumber-java8</artifactId>
        <version>2.3.1</version>
    </dependency>

Please help me to understand what dependencies you have

Thanks in advance..!!

Hello,

I have seen and tried from your code with cucumber-spring and cucumber java8 which didn't work so then I was using the below dependency with latest versions and it was working.

<dependency>
      <groupId>io.cucumber</groupId>
      <artifactId>cucumber-junit</artifactId>
      <version>2.4.0</version>
    </dependency>
    <dependency>
      <groupId>io.cucumber</groupId>
      <artifactId>cucumber-java</artifactId>
      <version>2.4.0</version>
    </dependency>
    <dependency>
      <groupId>info.cukes</groupId>
      <artifactId>gherkin</artifactId>
      <version>2.12.2</version>
      <scope>provided</scope>
    </dependency>

Hope this helps.

Udhay1316 commented 6 years ago

I tried with the above mentioned dependencies but I am getting the same error

cucumber.runtime.CucumberException: Couldn't load plugin class: com.vimalselvam.cucumber.listener.ExtentCucumberFormatter. It does not implement cucumber.api.Plugin

Note: Mine is Cucumner-Spring and Cucumber-java8 NOT Cucucmber-java

Thanks Udhay

On Mon, Oct 29, 2018 at 6:23 AM vamc264 notifications@github.com wrote:

2.12.2

I did the same but still I am getting below error

cucumber.runtime.CucumberException: Couldn't load plugin class: com.vimalselvam.cucumber.listener.ExtentCucumberFormatter. It does not implement cucumber.api.Plugin

I am using below dependencies along with gherkin dependency

io.cucumber cucumber-spring 2.3.1
<dependency>
    <groupId>io.cucumber</groupId>
    <artifactId>cucumber-java8</artifactId>
    <version>2.3.1</version>
</dependency>

Please help me to understand what dependencies you have

Thanks in advance..!!

Hello,

I have seen and tried from your code with cucumber-spring and cucumber java8 which didn't work so then I was using the below dependency with latest versions and it was working.

io.cucumber cucumber-junit 2.4.0
<dependency>
  <groupId>io.cucumber</groupId>
  <artifactId>cucumber-java</artifactId>
  <version>2.4.0</version>
</dependency>
<dependency>
  <groupId>info.cukes</groupId>
  <artifactId>gherkin</artifactId>
  <version>2.12.2</version>
  <scope>provided</scope>
</dependency>

Hope this helps.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/email2vimalraj/CucumberExtentReporter/issues/59#issuecomment-433875412, or mute the thread https://github.com/notifications/unsubscribe-auth/AkA0Vl0AiLhv_gDGwRAOL32ymO9rzJEXks5upuUkgaJpZM4Opmxb .

--

Udhay Gajula91-9618181880 Okkaraithe Ontari, Okkataithe Uppena...

Vjoshi123 commented 5 years ago

Hi All ,

While running the cucumber file with selenium , its giving the below error:

java.lang.NoClassDefFoundError: gherkin/formatter/Formatter at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(Unknown Source) at java.security.SecureClassLoader.defineClass(Unknown Source) at java.net.URLClassLoader.defineClass(Unknown Source) at java.net.URLClassLoader.access$100(Unknown Source) at java.net.URLClassLoader$1.run(Unknown Source) at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at cucumber.runtime.formatter.PluginFactory$1.(PluginFactory.java:53) at cucumber.runtime.formatter.PluginFactory.(PluginFactory.java:52) at cucumber.runtime.RuntimeOptions.(RuntimeOptions.java:70) at cucumber.runtime.RuntimeOptionsFactory.create(RuntimeOptionsFactory.java:25) at cucumber.api.junit.Cucumber.(Cucumber.java:56) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.lang.reflect.Constructor.newInstance(Unknown Source) at org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:104) at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:86) at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59) at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:26) at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59) at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:33) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.(JUnit4TestReference.java:33) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestClassReference.(JUnit4TestClassReference.java:25) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createTest(JUnit4TestLoader.java:48) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.loadTests(JUnit4TestLoader.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:452) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197) Caused by: java.lang.ClassNotFoundException: gherkin.formatter.Formatter at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) ... 35 more

Used Below Jars cucumber-core-1.2.5 junit-4.12 gherkin-2.12.2-javadoc hamcrest-core-1.3 cucumber-reporting-4.2.3 cucumber-jvm-deps-1.0.5 cucumber-junit-1.2.5 cucumber-java-1.2.5 cobertura-2.1.1 cucumber-html-0.2.6

jre1.8.0_191 Selenium standalone (3.141.59.jar)

I have attached all relevant screenshot . MyTest.feature @tag Feature: Reset functionality on login page of Application

@tag1 Scenario: Verification of Reset button Given Open the Chrome and launch the application When Enter the Username and Password Then Reset the credential

Runner.java package StepDefinition;

import org.junit.runner.RunWith; import cucumber.api.junit.Cucumber; import cucumber.api.CucumberOptions;

@RunWith(Cucumber.class) @CucumberOptions(features="StepDefinition",glue={"StepDefinition"})

public class Runner {

}

Steps.java

package StepDefinition; import cucumber.api.java.en.Given; import cucumber.api.java.en.Then; import cucumber.api.java.en.When;

public class Steps {

@Given("^Open the Chrome and launch the application$")

public void Open_the_Chrome_and_launch_the_application()throws Throwable 
{
    System.out.println("This step open the Chrome and lauch the browser.");
}

@When("^Enter the Username and Password$")

public void Enter_the_Username_and_Password()throws Throwable

{       
       System.out.println("This step enter the Username and Password on the login page.");                  
    }       

    @Then("^Reset the credential$")                 
    public void Reset_the_credential() throws Throwable                             
    {           
        System.out.println("This step click on the Reset button.");                 
    }       

}

suite

kavyamurthy1209 commented 5 years ago

Im also hitting same issue:

cucumber.runtime.CucumberException: Couldn't load plugin class: com.vimalselvam.cucumber.listener.ExtentCucumberFormatter. It does not implement cucumber.api.Plugin

Im using below dependencies:

cucumber-java 4.2.6 info.cukes gherkin 2.12.2

Please let me know solution.

pikomdas commented 5 years ago

@email2vimalraj , bro check the POM.xml, I am getting error `java.lang.NoClassDefFoundError: gherkin/formatter/Reporter at java.base/java.lang.ClassLoader.defineClass1(Native Method) at java.base/java.lang.ClassLoader.defineClass(Unknown Source) at java.base/java.security.SecureClassLoader.defineClass(Unknown Source) at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(Unknown Source) at java.base/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(Unknown Source) at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(Unknown Source) at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(Unknown Source) at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(Unknown Source) at java.base/java.lang.ClassLoader.loadClass(Unknown Source) at cucumber.runtime.formatter.PluginFactory.loadClass(PluginFactory.java:171) at cucumber.runtime.formatter.PluginFactory.pluginClass(PluginFactory.java:163) at cucumber.runtime.formatter.PluginFactory.getPluginClass(PluginFactory.java:220) at cucumber.runtime.formatter.PluginFactory.isStepDefinitionReporterName(PluginFactory.java:203) at cucumber.runtime.RuntimeOptions$ParsedPluginData.addPluginName(RuntimeOptions.java:386) at cucumber.runtime.RuntimeOptions.parse(RuntimeOptions.java:165) at cucumber.runtime.RuntimeOptions.(RuntimeOptions.java:108) at cucumber.runtime.RuntimeOptions.(RuntimeOptions.java:101) at cucumber.runtime.RuntimeOptions.(RuntimeOptions.java:97) at cucumber.runtime.RuntimeOptionsFactory.create(RuntimeOptionsFactory.java:23) at cucumber.api.junit.Cucumber.(Cucumber.java:83) at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.base/java.lang.reflect.Constructor.newInstance(Unknown Source) at org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:104) at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:86) at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59) at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:26) at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59) at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:33) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createUnfilteredTest(JUnit4TestLoader.java:90) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createTest(JUnit4TestLoader.java:76) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.loadTests(JUnit4TestLoader.java:49) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:525) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:763) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:463) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:209) Caused by: java.lang.ClassNotFoundException: gherkin.formatter.Reporter at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(Unknown Source) at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(Unknown Source) at java.base/java.lang.ClassLoader.loadClass(Unknown Source) ... 37 more

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

4.0.0
<groupId>packageName</groupId>
<artifactId>projectName</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>

<name>projectName</name>
<url>http://maven.apache.org</url>

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <junit.version>4.12</junit.version>
</properties>

<dependencies>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>${junit.version}</version>
        <scope>test</scope>
    </dependency>
    <!-- https://mvnrepository.com/artifact/io.cucumber/cucumber-java8 -->
    <dependency>
        <groupId>io.cucumber</groupId>
        <artifactId>cucumber-java8</artifactId>
        <version>4.2.6</version>
    </dependency>
    <!-- https://mvnrepository.com/artifact/io.cucumber/cucumber-junit -->
    <dependency>
        <groupId>io.cucumber</groupId>
        <artifactId>cucumber-junit</artifactId>
        <version>4.2.6</version>
        <scope>test</scope>
    </dependency>
    <!-- https://mvnrepository.com/artifact/io.cucumber/cucumber-jvm-deps -->
    <dependency>
        <groupId>io.cucumber</groupId>
        <artifactId>cucumber-jvm-deps</artifactId>
        <version>1.0.6</version>
        <scope>provided</scope>
    </dependency>
    <!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java -->
    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-java</artifactId>
        <version>3.141.59</version>
    </dependency>

    <!-- https://mvnrepository.com/artifact/net.masterthought/cucumber-reporting -->
    <dependency>
        <groupId>com.vimalselvam</groupId>
        <artifactId>cucumber-extentsreport</artifactId>
        <version>3.1.1</version>
    </dependency>
    <dependency>
        <groupId>com.aventstack</groupId>
        <artifactId>extentreports</artifactId>
        <version>3.1.1</version>
    </dependency>
    <!-- https://mvnrepository.com/artifact/io.cucumber/gherkin -->
    <dependency>
        <groupId>io.cucumber</groupId>
        <artifactId>gherkin</artifactId>
        <version>2.12.2</version>
    </dependency>

</dependencies>
<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.8.0</version>
            <configuration>
                <fork>true</fork>
                <!-- Added by Partha -->
                <source>10</source>
                <target>10</target>
            </configuration>
        </plugin>

    </plugins>
</build>

`

rajesh-app commented 5 years ago

use this version it solves

info.cukes gherkin 2.7.3
sseenivasan89 commented 4 years ago

Still i am facing same issue java.lang.NoClassDefFoundError: gherkin/formatter/Formatter

using below version in POM cucumber-junit - 4.8.0 cucumber-java - 4.8.0 gherkin - 6.0.13

chik145 commented 4 years ago

Still i am facing same issue java.lang.NoClassDefFoundError: gherkin/formatter/Formatter

using below version in POM cucumber-junit - 4.7.4 cucumber-java - 4.7.4 gherkin - 5.2.0

anshooarora commented 4 years ago

@chik145 Have a look at the version 4 adapter here: https://github.com/extent-framework/extentreports-cucumber4-adapter

chik145 commented 4 years ago

@anshooarora i am using 1.0.8 version of version 4 adapter but still same issue. this is my POM

<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

<modelVersion>4.0.0</modelVersion>
<groupId>groupId</groupId>
<artifactId>Compas_GO_UI</artifactId>
<version>1.0-SNAPSHOT</version>

<properties>
    <cucumber.version>4.7.4</cucumber.version>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<dependencies>

    <dependency>
        <groupId>io.cucumber</groupId>
        <artifactId>cucumber-junit</artifactId>
        <version>${cucumber.version}</version>
    </dependency>

    <dependency>
        <groupId>io.cucumber</groupId>
        <artifactId>cucumber-java</artifactId>
        <version>${cucumber.version}</version>
    </dependency>

    <dependency>
        <groupId>io.cucumber</groupId>
        <artifactId>cucumber-core</artifactId>
        <version>${cucumber.version}</version>
    </dependency>

    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-java</artifactId>
        <version>3.141.59</version>
    </dependency>

    <dependency>
        <groupId>commons-io</groupId>
        <artifactId>commons-io</artifactId>
        <version>2.6</version>
    </dependency>

    <dependency>
        <groupId>com.aventstack</groupId>
        <artifactId>extentreports</artifactId>
        <version>4.0.9</version>
    </dependency>

    <dependency>
        <groupId>org.junit.jupiter</groupId>
        <artifactId>junit-jupiter-api</artifactId>
        <version>5.5.2</version>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>com.aventstack</groupId>
        <artifactId>extentreports-cucumber4-adapter</artifactId>
        <version>1.0.8</version>
    </dependency>

    <dependency>
        <groupId>com.vimalselvam</groupId>
        <artifactId>cucumber-extentsreport</artifactId>
        <version>3.1.1</version>
    </dependency>

    <dependency>
        <groupId>io.cucumber</groupId>
        <artifactId>gherkin</artifactId>
        <version>5.2.0</version>
    </dependency>

    <dependency>
        <groupId>org.apache.poi</groupId>
        <artifactId>poi</artifactId>
        <version>4.1.1</version>
    </dependency>

    <dependency>
        <groupId>org.apache.poi</groupId>
        <artifactId>poi-ooxml</artifactId>
        <version>4.1.1</version>
    </dependency>

    <dependency>
        <groupId>net.masterthought</groupId>
        <artifactId>cucumber-reporting</artifactId>
        <version>4.11.2</version>
    </dependency>

</dependencies>
<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.22.2</version>
            <configuration>
                <testSourceDirectory>${basedir}/src/main/java/tests</testSourceDirectory>
                <testClassesDirectory>${project.build.directory}/classes/</testClassesDirectory>
                <includes>
                    <include>**/*Runner*.java</include>
                </includes>
                <parallel>all</parallel>
                <useUnlimitedThreads>true</useUnlimitedThreads>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.8.0</version>
            <configuration>
                <source>1.8</source>
                <target>1.8</target>
            </configuration>
        </plugin>
    </plugins>
</build>

anshooarora commented 4 years ago

Please open the issue in the relevant adapter's repo and share the details.

Would suggest removing the extentreports dependency as the adapter will resolve it anyways.

<dependency>
        <groupId>com.aventstack</groupId>
        <artifactId>extentreports</artifactId>
        <version>4.0.9</version>
</dependency>
chik145 commented 4 years ago

@anshooarora As the cucumber extent report is having issue, so i cannot remove the above dependency. as we are considering it as our primary report.

Greeshma-babu commented 4 years ago

Hi, I was facing the same issue. The following is the step of how I fixed it: I checked the gherkin version in my pom.xml and Referenced Libraries -> gherkin/formatter/Formatter was there. so the class could be found while not. I guess it may be difficult to solve this issue from pom...therefore I upload that jar file directly to the library...then it fixed finally and work well. Hope it is useful for you.

Please let me know the new gherkin version.

erkkpankaj commented 4 years ago

Below MAVEN dependency works for me, hope it helps:

info.cukes cucumber-jvm 1.2.5 pom info.cukes cucumber-jvm-deps 1.0.5 provided net.masterthought cucumber-reporting 4.11.2 org.seleniumhq.selenium selenium-java 3.141.59 junit junit 4.12 test io.cucumber cucumber-junit 2.4.0 io.cucumber cucumber-java 2.4.0 info.cukes gherkin 2.12.2 provided
ksujeet568 commented 4 years ago

I am facing similar issue with TestNG

Me too have you found the soutions? please share to me if you found the solution

sudheerah commented 4 years ago

I am facing the same error. Below is my maven dependencies

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <gherkin.version>5.1.0</gherkin.version>
        <cucumber.version>4.7.2</cucumber.version>
    </properties>
<dependency>
            <groupId>io.rest-assured</groupId>
            <artifactId>rest-assured</artifactId>
            <version>RELEASE</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>io.rest-assured</groupId>
            <artifactId>json-path</artifactId>
            <version>RELEASE</version>
        </dependency>
        <dependency>
            <groupId>io.rest-assured</groupId>
            <artifactId>xml-path</artifactId>
            <version>RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.json</groupId>
            <artifactId>json</artifactId>
            <version>20190722</version>
        </dependency>
        <dependency>
            <groupId>io.cucumber</groupId>
            <artifactId>gherkin</artifactId>
            <version>${gherkin.version}</version>
        </dependency>
        <dependency>
            <groupId>io.cucumber</groupId>
            <artifactId>cucumber-core</artifactId>
            <version>${cucumber.version}</version>
        </dependency>
        <dependency>
            <groupId>io.cucumber</groupId>
            <artifactId>cucumber-java</artifactId>
            <version>${cucumber.version}</version>
        </dependency>
        <dependency>
            <groupId>io.cucumber</groupId>
            <artifactId>cucumber-junit</artifactId>
            <version>${cucumber.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>io.cucumber</groupId>
            <artifactId>cucumber-picocontainer</artifactId>
            <version>${cucumber.version}</version>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.12</version>
            <scope>test</scope>
        </dependency>
    </dependencies>
erkkpankaj commented 4 years ago

This POM.xml works fine for me, you can pick the required dependency:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

4.0.0
<groupId>CucumberDemo</groupId>
<artifactId>IVLCucumberAutomation</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>

<name>IVLCucumberAutomation</name>
<url>http://maven.apache.org</url>

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<dependencies>

    <dependency>
        <groupId>io.cucumber</groupId>
        <artifactId>cucumber-testng</artifactId>
        <version>2.0.0</version>
    </dependency>

    <dependency>
        <groupId>log4j</groupId>
        <artifactId>log4j</artifactId>
        <version>1.2.17</version>
    </dependency>

    <dependency>
        <groupId>info.cukes</groupId>
        <artifactId>cucumber-jvm</artifactId>
        <version>1.2.5</version>
        <type>pom</type>
    </dependency>

    <dependency>
        <groupId>info.cukes</groupId>
        <artifactId>cucumber-jvm-deps</artifactId>
        <version>1.0.5</version>
        <scope>provided</scope>
    </dependency>

    <dependency>
        <groupId>net.masterthought</groupId>
        <artifactId>cucumber-reporting</artifactId>
        <version>4.11.2</version>
    </dependency>

    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-java</artifactId>
        <version>3.141.59</version>
    </dependency>

    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.12</version>
    </dependency>

    <dependency>
        <groupId>io.cucumber</groupId>
        <artifactId>cucumber-junit</artifactId>
        <version>2.4.0</version>
    </dependency>

    <dependency>
        <groupId>io.cucumber</groupId>
        <artifactId>cucumber-java</artifactId>
        <version>2.4.0</version>
    </dependency>

    <dependency>
<groupId>com.google.inject</groupId>
<artifactId>guice</artifactId>
<version>3.0</version>

</dependencies>
<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-resources-plugin</artifactId>
            <version>2.4</version>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.19.1</version>
            <configuration>
                <testFailureIgnore>true </testFailureIgnore>
                <suiteXmlFiles>
                    <!-- src/test/resources/testSuites/testng.xml -->
                    <suiteXmlFile>testNg.xml</suiteXmlFile>
                </suiteXmlFiles>
            </configuration>
        </plugin>
        <plugin>
            <groupId>net.masterthought</groupId>
            <artifactId>maven-cucumber-reporting</artifactId>
            <version>3.8.0</version>
            <executions>
                <execution>
                    <id>execution</id>
                    <!-- <phase>verify</phase> -->
                    <goals>
                        <goal>generate</goal>
                    </goals>
                    <configuration>
                        <projectName>IVLCucumberDemo</projectName>  <!-- Replace with project name -->
                        <outputDirectory>target/cucumber-reports/advanced-reports</outputDirectory>
                        <cucumberOutput>target/cucumber-reports/CucumberTestReport.json</cucumberOutput>
                        <buildNumber>1</buildNumber>
                        <parallelTesting>false</parallelTesting>
                    </configuration>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>