title: How to run Cucumber tests with 'mvn test'
body: <p>Note that I'm using Kotlin.<br>
  Also note that I have a multi-modules application.</p>
  
  <p>I succeed in running Cucumber tests from the IDE by running the <code>RunCukesTest.kt</code> class.</p>
  
  <p>My problem is that when I run the command <code>mvn test</code>, The <code>RunCukesTest.kt</code> doesn't seems to run, and none <code>.feature</code> is tested.</p>
  
  <p>I'm not sure if I need to configure the <code>maven-surefire-plugin</code> in order to make it work.</p>
  
  <p><strong>domain-pom.xml</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &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;parent&gt;
          &lt;artifactId&gt;smart-notes&lt;/artifactId&gt;
          &lt;groupId&gt;xxx&lt;/groupId&gt;
          &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
      &lt;/parent&gt;
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  
      &lt;artifactId&gt;domain&lt;/artifactId&gt;
  
      &lt;properties&gt;
          &lt;cucumber.version&gt;4.4.0&lt;/cucumber.version&gt;
          &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
          &lt;junit.version&gt;4.12&lt;/junit.version&gt;
      &lt;/properties&gt;
  
      &lt;dependencies&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;io.cucumber&lt;/groupId&gt;
              &lt;artifactId&gt;cucumber-java8&lt;/artifactId&gt;
              &lt;version&gt;${cucumber.version}&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;io.cucumber&lt;/groupId&gt;
              &lt;artifactId&gt;cucumber-junit&lt;/artifactId&gt;
              &lt;version&gt;${cucumber.version}&lt;/version&gt;
              &lt;scope&gt;test&lt;/scope&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;junit&lt;/groupId&gt;
              &lt;artifactId&gt;junit&lt;/artifactId&gt;
              &lt;version&gt;${junit.version}&lt;/version&gt;
              &lt;scope&gt;test&lt;/scope&gt;
          &lt;/dependency&gt;
      &lt;/dependencies&gt;
  &lt;/project&gt;
  </code></pre>
  
  <p><strong>parent-pom.xml</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &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;packaging&gt;pom&lt;/packaging&gt;
      &lt;modules&gt;
          &lt;module&gt;domain&lt;/module&gt;
          &lt;module&gt;infra&lt;/module&gt;
      &lt;/modules&gt;
      &lt;parent&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-parent&lt;/artifactId&gt;
          &lt;version&gt;2.1.6.RELEASE&lt;/version&gt;
          &lt;relativePath/&gt; &lt;!-- lookup parent from repository --&gt;
      &lt;/parent&gt;
      &lt;groupId&gt;xxx&lt;/groupId&gt;
      &lt;artifactId&gt;smart-notes&lt;/artifactId&gt;
      &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
      &lt;name&gt;smart-notes&lt;/name&gt;
      &lt;description&gt;Take quick smart notes&lt;/description&gt;
  
      &lt;properties&gt;
          &lt;java.version&gt;1.8&lt;/java.version&gt;
          &lt;kotlin.version&gt;1.3.40&lt;/kotlin.version&gt;
          &lt;junit-jupiter.version&gt;5.4.2&lt;/junit-jupiter.version&gt;
      &lt;/properties&gt;
  
      &lt;dependencies&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;com.fasterxml.jackson.module&lt;/groupId&gt;
              &lt;artifactId&gt;jackson-module-kotlin&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.jetbrains.kotlin&lt;/groupId&gt;
              &lt;artifactId&gt;kotlin-reflect&lt;/artifactId&gt;
              &lt;version&gt;${kotlin.version}&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.jetbrains.kotlin&lt;/groupId&gt;
              &lt;artifactId&gt;kotlin-stdlib-jdk8&lt;/artifactId&gt;
              &lt;version&gt;${kotlin.version}&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.junit.jupiter&lt;/groupId&gt;
              &lt;artifactId&gt;junit-jupiter&lt;/artifactId&gt;
              &lt;version&gt;${junit-jupiter.version}&lt;/version&gt;
              &lt;scope&gt;test&lt;/scope&gt;
          &lt;/dependency&gt;
      &lt;/dependencies&gt;
  
      &lt;build&gt;
          &lt;sourceDirectory&gt;${project.basedir}/src/main/kotlin&lt;/sourceDirectory&gt;
          &lt;testSourceDirectory&gt;${project.basedir}/src/test/kotlin&lt;/testSourceDirectory&gt;
          &lt;plugins&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.jetbrains.kotlin&lt;/groupId&gt;
                  &lt;artifactId&gt;kotlin-maven-plugin&lt;/artifactId&gt;
                  &lt;version&gt;${kotlin.version}&lt;/version&gt;
  
                  &lt;configuration&gt;
                      &lt;jvmTarget&gt;1.8&lt;/jvmTarget&gt;
                      &lt;args&gt;
                          &lt;arg&gt;-Xjsr305=strict&lt;/arg&gt;
                      &lt;/args&gt;
                      &lt;compilerPlugins&gt;
                          &lt;plugin&gt;spring&lt;/plugin&gt;
                      &lt;/compilerPlugins&gt;
                  &lt;/configuration&gt;
  
                  &lt;dependencies&gt;
                      &lt;dependency&gt;
                          &lt;groupId&gt;org.jetbrains.kotlin&lt;/groupId&gt;
                          &lt;artifactId&gt;kotlin-maven-allopen&lt;/artifactId&gt;
                          &lt;version&gt;${kotlin.version}&lt;/version&gt;
                      &lt;/dependency&gt;
                  &lt;/dependencies&gt;
              &lt;/plugin&gt;
  
              &lt;plugin&gt;
                  &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
                  &lt;artifactId&gt;spring-boot-maven-plugin&lt;/artifactId&gt;
                  &lt;configuration&gt;
                      &lt;skip&gt;true&lt;/skip&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&gt;
          &lt;/plugins&gt;
      &lt;/build&gt;
  &lt;/project&gt;
  </code></pre>
  
  <p><strong>RunCukesTest.kt</strong></p>
  
  <pre class="lang-java prettyprint-override"><code>import cucumber.api.CucumberOptions
  import cucumber.api.junit.Cucumber
  import org.junit.runner.RunWith
  
  @RunWith(Cucumber::class)
  @CucumberOptions(
          plugin = ["pretty"],
          features = ["classpath:features"],
          glue = ["classpath:acceptance.stepdefs"])
  class RunCukesTest
  
  </code></pre>
  
  <p><strong>some-feature.feature</strong></p>
  
  <pre class="lang-java prettyprint-override"><code>Feature: Is it friday yet
  
    Scenario: my scenario
      Given today is Sunday
      When I ask whether it's Friday yet
      Then I should be told "Nope"
  </code></pre>
  
  <p><strong>Maven build logs</strong></p>
  
  <pre><code>[INFO] 
  [INFO] --- maven-surefire-plugin:2.22.2:test (default-test) @ domain ---
  [INFO] 
  [INFO] -------------------------------------------------------
  [INFO]  T E S T S
  [INFO] -------------------------------------------------------
  [INFO] 
  [INFO] Results:
  [INFO] 
  [INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
  [INFO] 
  [INFO] ------------------------------------------------------------------------
  [INFO] BUILD SUCCESS
  [INFO] ------------------------------------------------------------------------
  [INFO] Total time:  9.209 s
  [INFO] Finished at: 2019-06-23T16:46:35+02:00
  [INFO] ------------------------------------------------------------------------
  </code></pre>
  
  <p><strong>Architecture</strong></p>
  
  <ul>
  <li><p>src</p>
  
  <ul>
  <li><p>test</p>
  
  <ul>
  <li><p>kotlin</p>
  
  <ul>
  <li>acceptance
  
  <ul>
  <li>RunCukesTest.kt</li>
  <li>stepdefs
  
  <ul>
  <li>StepDefsTest.kt</li>
  </ul></li>
  </ul></li>
  </ul></li>
  <li><p>resources</p>
  
  <ul>
  <li>features
  
  <ul>
  <li>some-feature.feature</li>
  </ul></li>
  </ul></li>
  </ul></li>
  </ul></li>
  </ul>
  
  <p>Thank you for your time :)</p>