Banjo
Banjo

Reputation: 91

Cucumber error - `Exception in thread "main" java.lang.NoClassDefFoundError: gherkin/IGherkinDialectProvider`

Im getting this error while running a very basic feature file in Eclipse through Selenium in Java

Exception in thread"main"java.lang.NoClassDefFoundError: gherkin/IGherkinDialectProvider Im using the following jars

cucumber-java-4.3.0 , cucumber-core-4.3.0 , gherkin-6.0.17 and junit-4.12

Any help is appreciated.

Upvotes: 0

Views: 1757

Answers (2)

Please remove cucumber-core, cucumber-java, gherkin and Junit. They're transitive dependencies and will be provided by your dependencies.(You can add below set of dependency)

<dependency>
    <groupId>io.cucumber</groupId>
    <artifactId>cucumber-junit</artifactId>
    <version>4.3.0</version>
    <scope>test</scope>
</dependency>

<dependency>
    <groupId>io.cucumber</groupId>
    <artifactId>cucumber-picocontainer</artifactId>
    <version>4.3.0</version>
    <scope>test</scope>
</dependency>

Upvotes: 1

Marit
Marit

Reputation: 3026

Your version of Gherkin doesn't match the one Cucumber 4.3.0 is using; replace it with gherkin-5.1.0. (See the pom.xml.)

In general, I'd recommend using a dependency manager (Maven or Gradle) to make sure you are getting the correct transitive dependencies. You can find which dependencies you need for Cucumber in the installation docs.

Upvotes: 2

Related Questions