title: Run JAVA+Cucumber+JUnit Maven project in command line
body: <p>I am with a small problem here: run this project using MAVEN and Cucumber.</p>
  
  <p>I'm with the following structure in my MAVEN project:</p>
  
  <pre><code>```
  br.com.home.cucumberProjectWithWS
                  |--- src/tests/java
                  |                             |--- com.home.Model (secret)
                  |                             |--- com.home.Control (secret)
                  |                             |--- com.home.View
                                                 |                             |--- ... (secret)
                                                 |                             |--- Runner.java
                  |                             |--- com.home.javaStepsFolder
                  |                                                             |--- MyTestsSteps.java
                  |--- src/main/java
                  |--- src/main/resources
                  |--- src/tests/resources
                  |--- featuresFolder
                  |                             |--- FirstFeature.feature
                  |                             |--- SecondFeature.feature
                  |                             |--- ThirdFeature.feature
                  |--- pom.xml
  ```
  </code></pre>
  
  <p>The <code>Runner.java</code> class is the following:</p>
  
  <pre><code>```
  package br.com.home.runner;
  
  import org.junit.runner.RunWith;
  
  import cucumber.api.CucumberOptions;
  import cucumber.api.junit.Cucumber;
  
  @RunWith(Cucumber.class)
  @CucumberOptions(monochrome = false, plugin = { "html:target/cucumber-html-report", "json:target/cucumber.json",
                                 "pretty:target/cucumber-pretty.txt", "usage:target/cucumber-usage.json",
                                 "junit:target/cucumber-results.xml" }, features = "featuresFolder", glue = { "br.com.home.javaStepsFolder" })
  public class Runner {
  
  }
  ```
  </code></pre>
  
  <p>The class <code>MyTestsSteps.java</code> is something like the following:</p>
  
  <pre><code>```
  package br.com.home.runner;
  
  import cucumber.api.*;
  
  class MyTestsSteps{
  
                  Scenario scenario;
                  Controller controller = new Control();
  
                  @Before
                  public void doItBefore(Scenario scenario){
                                 this.scenario = scenario;
                  }
  
                  @When("^we do something$")
                  public void doSomething(){
                                 controller.doSomething();
                  }
  
                  @When("^we do something else$")
                  public void doSomethingElse(){
                                 controller.doSomethingElse();
                  }
  
                  @Then("^we expect \"([^\"]*)$")
                  public void weExpectSomeResult(String result){
                                 assertTrue(controller.getResultExpected().equals(result));
                  }
  }
  ```
  
  And my `pom.xml` is the following:
  
  ```
  &lt;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"&gt;
                  &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
                  &lt;groupId&gt;com.home.cucumberProjectWithWS&lt;/groupId&gt;
                  &lt;artifactId&gt;com.home.cucumberProjectWithWS&lt;/artifactId&gt;
                  &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
  
                  &lt;dependencies&gt;
                                 &lt;!-- CUCUMBER --&gt;
  
                                 &lt;!-- CUCUMBER: Java --&gt;
  
                                 &lt;dependency&gt;
                                                 &lt;groupId&gt;info.cukes&lt;/groupId&gt;
                                                 &lt;artifactId&gt;cucumber-java&lt;/artifactId&gt;
                                                 &lt;version&gt;1.2.4&lt;/version&gt;
                                                 &lt;scope&gt;test&lt;/scope&gt;
                                 &lt;/dependency&gt;
  
                                 &lt;!-- CUCUMBER: Core --&gt;
                                 &lt;dependency&gt;
                                                 &lt;groupId&gt;info.cukes&lt;/groupId&gt;
                                                 &lt;artifactId&gt;cucumber-core&lt;/artifactId&gt;
                                                 &lt;version&gt;1.2.4&lt;/version&gt;
                                 &lt;/dependency&gt;
  
                                 &lt;!-- CUCUMBER: JUnit --&gt;
                                 &lt;dependency&gt;
                                                 &lt;groupId&gt;info.cukes&lt;/groupId&gt;
                                                 &lt;artifactId&gt;cucumber-junit&lt;/artifactId&gt;
                                                 &lt;version&gt;1.2.4&lt;/version&gt;
                                                 &lt;scope&gt;test&lt;/scope&gt;
                                 &lt;/dependency&gt;
  
                                 &lt;!-- CUCUMBER: JVM Deps --&gt;
                                 &lt;dependency&gt;
                                                 &lt;groupId&gt;info.cukes&lt;/groupId&gt;
                                                 &lt;artifactId&gt;cucumber-jvm-deps&lt;/artifactId&gt;
                                                 &lt;version&gt;1.0.5&lt;/version&gt;
                                 &lt;/dependency&gt;
  
                                 &lt;!-- CUCUMBER: Reports --&gt;
                                 &lt;dependency&gt;
                                                 &lt;groupId&gt;net.masterthought&lt;/groupId&gt;
                                                 &lt;artifactId&gt;cucumber-reporting&lt;/artifactId&gt;
                                                 &lt;version&gt;2.5.0&lt;/version&gt;
                                 &lt;/dependency&gt;
  
                                 &lt;!-- CUCUMBER: Gherkin --&gt;
                                 &lt;dependency&gt;
                                                 &lt;groupId&gt;info.cukes&lt;/groupId&gt;
                                                 &lt;artifactId&gt;gherkin&lt;/artifactId&gt;
                                                 &lt;version&gt;2.12.2&lt;/version&gt;
                                 &lt;/dependency&gt;
  
                                 &lt;!-- MOCKITO: All --&gt;
                                 &lt;dependency&gt;
                                                 &lt;groupId&gt;org.mockito&lt;/groupId&gt;
                                                 &lt;artifactId&gt;mockito-all&lt;/artifactId&gt;
                                                 &lt;version&gt;1.10.19&lt;/version&gt;
                                 &lt;/dependency&gt;
  
                                 &lt;!-- JUNIT --&gt;
                                 &lt;dependency&gt;
                                                 &lt;groupId&gt;junit&lt;/groupId&gt;
                                                 &lt;artifactId&gt;junit&lt;/artifactId&gt;
                                                 &lt;version&gt;4.11&lt;/version&gt;
                                                 &lt;scope&gt;test&lt;/scope&gt;
                                 &lt;/dependency&gt;
                  &lt;/dependencies&gt;
  
  
                  &lt;build&gt;
                                 &lt;sourceDirectory&gt;src/main/java&lt;/sourceDirectory&gt;
                                 &lt;plugins&gt;
                                                 &lt;plugin&gt;
                                                                 &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
                                                                 &lt;version&gt;3.3&lt;/version&gt;
                                                                 &lt;configuration&gt;
                                                                                 &lt;source&gt;1.8&lt;/source&gt;
                                                                                 &lt;target&gt;1.8&lt;/target&gt;
                                                                                 &lt;encoding&gt;UTF-8&lt;/encoding&gt;
                                                                 &lt;/configuration&gt;
                                                 &lt;/plugin&gt;
  
                                                 &lt;plugin&gt;
                                                                 &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                                                                 &lt;artifactId&gt;maven-surefire-plugin&lt;/artifactId&gt;
                                                                 &lt;version&gt;2.19.1&lt;/version&gt;
                                                                 &lt;configuration&gt;
                                                                                 &lt;properties&gt;
                                                                                                &lt;property&gt;
                                                                                                                &lt;name&gt;junit&lt;/name&gt;
                                                                                                                &lt;value&gt;true&lt;/value&gt;
                                                                                                &lt;/property&gt;
                                                                                 &lt;/properties&gt;
                                                                                 &lt;includes&gt;
                                                                                                &lt;include&gt;**/*Runner.java&lt;/include&gt;
                                                                                 &lt;/includes&gt;
                                                                 &lt;/configuration&gt;
                                                 &lt;/plugin&gt;
  
                                 &lt;/plugins&gt;
                  &lt;/build&gt;
  
  &lt;/project&gt;
  ```
  </code></pre>
  
  <p>I try to run:</p>
  
  <pre><code>```
  mvn clean test
  ```
  </code></pre>
  
  <p>And it does not works.</p>
  
  <p>I want to run those tests using Maven and know if is possible set the sequence of execution of Cucumber Tests.</p>
  
  <p>I have tried to define in @CucumberOptions features parameter, but it did not work!</p>
  
  <pre><code>```
  features = "{featuresFolder/FirstFeature.feature, featuresFolder/SecondFeature.feature}"
  ```
  </code></pre>
  
  <p>and </p>
  
  <pre><code>```
  features = {
                  "featuresFolder/FirstFeature.feature", 
                  "featuresFolder/SecondFeature.feature"
  }
  ```
  </code></pre>
  
  <p>And tries to do (as recommended in other post here):</p>
  
  <pre><code>```
  &lt;includes&gt;
                  &lt;exclude&gt;**/*Runner.java&lt;/exclude&gt;
  &lt;/includes&gt;
  ```
  </code></pre>
  
  <p>in <code>pom.xml</code> surefire-plugin configuration.</p>
  
  <p>But it did not work too.</p>
  
  <p>Someone could help me to run this project using MAVEN command line and Cucumber if possible.</p>
  
  <p>I am using Windows 8.1!
  And the project will run in Linux in future.</p>
  
  <p>Thanks.</p>