Search code examples
eclipsemavencucumberkarate

Could not run mvn test on karate-template project in Eclipse


I cloned the karate template i.e https://github.com/karatelabs/karate-template and I was able to run tests on my Eclipse IDE.

However I was not able to run tests using mvn test though I have mvn installed.

Just using the same POM.xml as in the template repo.

Please could someone advise what am I missing here.?

enter image description here

Tried mvn version 3.6.3 and also 3.9, but same result


Solution

  • Based on the error message, my best guess is that you are on Java 8.

    Karate 1.4.0 requires Java 11.

    If you use Eclipse, the Eclipse Cucumber plugin can be used to run Features or Scenarios if you add a Java class called Main to your test classpath in the cucumber.api.cli package (src/test/java/cucumber/api/cli/Main.java) with the following code:

    package cucumber.api.cli;
    
    public class Main {
        
        public static void main(String[] args) {
            com.intuit.karate.cli.IdeMain.main(args);
        }   
    
    }
    

    enter image description here