Updating cucumber-java from 1.2.4 of info.cukes's to 4.2.2 of cucumber.io throwing import Given(Or When/Then) cannot be resolved error

As part of update, I had to migrate from info.cukes's cucumber-java with version 1.2.4 to io.cucumber's cucumber-java with version 4.2.2, but the code which ran successfully with older version of cucumber started throwing error, which says The import cucumber.api.java.en.Given(Or When/Then) cannot be resolved

Below is the cucumber class from where execution is starting

    {
     @RunWith(Cucumber.class)
     @CucumberOptions(features = "classpath:features/functional/",
     glue = {"com.jacksparrow.automation.steps_definitions.functional" },
     tags = { "@guest_search_in_progress" },
     plugin = { "pretty","json:target/cucumber-json/cucumber.json",
     "junit:target/cucumber-reports/Cucumber.xml", "html:target/cucumber- 
     reports"},
     strict = false,
     dryRun = false,
     monochrome = true)
      public class FunctionalRunCuke {
     }

     <dependency>
                <groupId>io.cucumber</groupId>
                <artifactId>cucumber-core</artifactId>
                <version>4.2.2</version>
            </dependency>

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

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

            <dependency>
                <groupId>io.cucumber</groupId>
                <artifactId>cucumber-jvm-deps</artifactId>
                <version>1.0.6</version>
                <scope>provided</scope>
            </dependency>

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

            <dependency>
                <groupId>org.mockito</groupId>
                <artifactId>mockito-all</artifactId>
                <version>1.10.19</version>
                <scope>test</scope>
            </dependency>

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

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





     }

Please suggest what should i do to resolve this

Please use below dependencies in POM & add JUnit/TestNG dependency based on your framework requirement. (Just change v. 4.2.3 to V.4.2.2)

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

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

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

<dependency>
    <groupId>io.cucumber</groupId>
    <artifactId>datatable</artifactId>
    <version>1.1.12</version>
</dependency>

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

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

Updating cucumber-java from 1.2.4 of info.cukes's to 4.2 - html, Updating cucumber-java from 1.2.4 of info.cukes's to 4.2.2 of cucumber.io throwing import Given(Or When/Then) cannot be resolved error - cucumber. Note: There is a new version for this artifact. New Version: 1.2.6: Maven; Gradle; SBT; Ivy; Grape; Leiningen; Buildr

First of all, remove the cucumber-jvm-deps and the gherkin dependencies, as they might interfere with transitive dependencies from cucumber 4.2.2. Second, if you want to use Cucumber with JUnit, you'll also need to import Junit (v4.12; as v5 is not yet supported by Cucumber). And you'll want to remove the cucumber-testng dependency (or vice versa, if you want to use TestNg, remove cucumber-junit and you'll probably need a TestNg dependency). Finally, you might need to update import statements, if their locations have changed in the new Cucumber version.

While migrating from info.cukes to Cucumber V4 [io.cucumber , Environment - Selenium V 3.8.1 | Cucumber Version 1.2.4 | Java 1.8 I am migrating from Cucumber Version 1.2.4 [info.cukes] to V.4.2.2 io.cucumber. After this� Environment - Selenium V 3.8.1 | Cucumber Version 1.2.4 | Java 1.8 I am migrating from Cucumber Version 1.2.4 [info.cukes] to V.4.2.2 io.cucumber. After this, Cucumber Framework is not able to identify @Given/When/Then annotations and gi

issue was because of using wrong set of cucumber dependencies. Below is correct set of Cucumber dependencies which shall be used while migrating to 4.0.0 and please note - 1. All the Cucumber dependencies shall be of same version. 2. Use JUnit or TestNG as per your framework requirement.

info.cukes � cucumber-java � 1.2.4, Home � info.cukes � cucumber-jvm � 1.2.4 HomePage, http://cukes.info/. Date, (Jul 23 Category/License, Group / Artifact, Version, Updates� Artifact cucumber-java Group info.cukes Version 1.2.6 Last update 09. November 2019 Newest version Yes Organization not specified URL Not specified License not specified Dependencies amount 0 Dependencies No dependencies There are maybe transitive dependencies!

info.cukes � cucumber-jvm � 1.2.4, Artifact cucumber-java. Group info.cukes. Version 1.2.4. Last update 23. July 2015. Newest version No Tags: https open projects maven sonatype repositories � Note: This artifact was moved to: . io.cucumber » : Central (44)

Download cucumber-java JAR 1.2.4 With all dependencies!, Download cucumber-picocontainer JAR 1.2.4 ✓ Free ✓ With dependencies ✓ Source of cucumber-picocontainer ☄ One click! These are the files of the artifact cucumber-picocontainer version 1.2.4 from the group info.cukes. Last update 23. Dependencies cucumber-java, cucumber-jvm-deps, gherkin, picocontainer, info.cukes » cucumber-java MIT. Cucumber JVM: Java Last Release on Nov 10, 2019 3. Cucumber JVM: Core 105 usages. info.cukes » cucumber-core MIT. Cucumber JVM: Core

Download cucumber-picocontainer JAR 1.2.4 With all dependencies!, Artifact cucumber-java. Group info.cukes. Version 1.2.6. Last update 09. November 2019. Newest version Yes Organization not specified. URL Not specified Note: There is a new version for this artifact. New Version: 1.2.6: Maven; Gradle; SBT; Ivy; Grape; Leiningen; Buildr

Comments
  • Duplicate of: stackoverflow.com/questions/54569416/…
  • This works, but you also need to delete all your imports, and then import the new io.cucumber libraries.
  • Also don't forget to use the same version for all cucumber- dependencies.