Cucumber cannot be resolved to a type
I also faced the same issue in IntelliJ idea, When I check in the imported libraries it was like below screenshot.
So I remove scope tag from my import in pom file.Then it worked.
Earlier
<dependency> <groupId>info.cukes</groupId> <artifactId>cucumber-junit</artifactId> <version>1.2.5</version> <scope>test</scope></dependency>
Fix
<dependency> <groupId>info.cukes</groupId> <artifactId>cucumber-junit</artifactId> <version>1.2.5</version></dependency>
Now it is working fine
Import the cucumber.api.junit.Cucumber
class. It seems you are using Eclipse IDE, so you can import the classes using the Ctrl+Shift+o
(alphabet 'o' not zero) shortcut.
(Ctrl+Shift+O
is 'Organise Imports', and will add any missing imports, remove any unused ones, and order all of your imports). The command is also found under Source > Organise Imports.