title: Cucumber 1.2.4 not finding step definitions: "You can implement missing steps with the snippets below" (2016)
body: <p>I'm trying to run Cucumber with Maven on a UNIX-like (unfortunately I'm forced to use Windows, though cmd.exe has the same results) command line:</p>
  
  <p><code>mvn clean test -Dcucumber.options="src/test/resources/com/example/sqa/automation_cuke/pages/sample_test.feature"</code></p>
  
  <p>Results in:</p>
  
  <pre><code>Results :
  
  Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
  ...
  [INFO] --- exec-maven-plugin:1.2.1:java (default) @ sqa.automation_cuke ---
  Feature: My animals Sample
    Sample test to use as basis for conversion
  
    Scenario: My animals           # sample_test.feature:4
      Given that I have my animals
  
  1 Scenarios (1 undefined)
  1 Steps (1 undefined)
  0m0.000s
  
  
  You can implement missing steps with the snippets below:
  
  @Given("^that I have my animals$")
  public void that_I_have_my_animals() throws Throwable {
      // Write code here that turns the phrase above into concrete actions
      throw new PendingException();
  }
  </code></pre>
  
  <p>I've looked at all the top Google/SO searches for this and similar error messages. Many, such as <a href="https://stackoverflow.com/questions/16639310/cucumber-cant-find-steps-when-running-a-single-feature">Cucumber can&#39;t find steps when running a single feature</a> and <a href="https://stackoverflow.com/questions/18772970/cucumber-not-finding-step-definitions">Cucumber not finding step definitions</a>, say to specify my step definitions with the <code>-r</code> and --require parameters but they appear to have been removed from Cucumber at some point, as I get an <code>Unknown option: -r</code> error. </p>
  
  <p>Many other answers say that this error (strangely) happens when the @CucumberOptions <em>glue parameter</em> is defined incorrectly. But I've tried the following glues and none have worked:</p>
  
  <p><code>
      sqa.automation_cuke.pages
      path:sqa.automation_cuke.pages
      classpath:sqa.automation_cuke.pages
      com.example.sqa.automation_cuke.pages
      classpath:com.example.sqa.automation_cuke.pages
      path:com.example.sqa.automation_cuke.pages
      C:/development/cucumber-demo/src/main/java/com/example/sqa/automation_cuke/pages
      src/main/java/com/example/sqa/automation_cuke/pages
      classpath:C:/development/cucumber-demo/src/main/java/com/example/sqa/automation_cuke/pages
      classpath:src/main/java/com/example/sqa/automation_cuke/pages
      path:src/main/java/com/example/sqa/automation_cuke/pages
      C:\\development\\cucumber-demo\\src\\main\\java\\com\\example\\sqa\\automation_cuke\\pages
      src\\main\\java\\com\\example\\sqa\\automation_cuke\\pages
      classpath:src\\main\\java\\com\\example\\sqa\\automation_cuke\\pages
      path:src\\main\\java\\com\\example\\sqa\\automation_cuke\\pages
  </code></p>
  
  <p>I've also tried:</p>
  
  <ul>
  <li>Defining --glue in <code>-Dcucumber.options</code>. </li>
  <li>Changing my source code
  directory structure to src/test/java/example/automation_cuke,
  src/main/java/example/automation_cuke,
  src/test/resources/example/automation_cuke, etc. </li>
  <li>Putting my .feature
  file in main...resources. </li>
  <li>Various different texts in @Given, such as <code>@Given("that I have my animals")</code>.</li>
  </ul>
  
  <p>This is my project structure. I made sure the resource structure matches the rest of the code <a href="https://stackoverflow.com/a/9663153">as per this answer</a>:</p>
  
  <p><a href="https://i.stack.imgur.com/4F3Qp.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/4F3Qp.png" alt="cucumber-demo project structure"></a></p>
  
  <p>sample_text.feature:</p>
  
  <pre><code>Feature: My animals Sample
    Sample test to use as basis for conversion
  
    Scenario: My animals
      Given that I have my animals
  </code></pre>
  
  <p>MySampleTest.java:</p>
  
  <pre><code>package com.example.sqa.automation_cuke.pages;
  
  @RunWith(Cucumber.class)
  @CucumberOptions(glue = {"com.example.sqa.automation_cuke.pages"})
  public class MySampleTest {
  
      @Given("^that I have my animals$")
      public void that_I_have_my_animals() throws Throwable {
          // Write code here that turns the phrase above into concrete actions
          System.out.println("MySampleTest.that_I_have_my_animals() ran!");
          new MySample().printMySample();
          throw new PendingException();
      }
  }
  </code></pre>
  
  <p>pom.xml:</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;groupId&gt;com.example&lt;/groupId&gt;
      &lt;artifactId&gt;sqa.automation_cuke&lt;/artifactId&gt;
      &lt;version&gt;1.0-SNAPSHOT&lt;/version&gt;
  
      &lt;properties&gt;
          &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
          &lt;cucumber-jvm.version&gt;1.2.4&lt;/cucumber-jvm.version&gt;
          &lt;selenium.version&gt;2.53.0&lt;/selenium.version&gt;
          &lt;junit.version&gt;4.12&lt;/junit.version&gt;
      &lt;/properties&gt;
  
      &lt;build&gt;
  
          &lt;plugins&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt;
                  &lt;artifactId&gt;exec-maven-plugin&lt;/artifactId&gt;
                  &lt;version&gt;1.2.1&lt;/version&gt;
                  &lt;executions&gt;
                      &lt;execution&gt;
                          &lt;phase&gt;test&lt;/phase&gt;
                          &lt;goals&gt;
                              &lt;goal&gt;java&lt;/goal&gt;
                          &lt;/goals&gt;
                      &lt;/execution&gt;
                  &lt;/executions&gt;
                  &lt;configuration&gt;
                      &lt;executableDependency&gt;
                          &lt;groupId&gt;info.cukes&lt;/groupId&gt;
                          &lt;artifactId&gt;cucumber-core&lt;/artifactId&gt;
                      &lt;/executableDependency&gt;
                      &lt;mainClass&gt;cucumber.api.cli.Main&lt;/mainClass&gt;
                      &lt;arguments&gt;
                          &lt;argument&gt;--plugin&lt;/argument&gt;
                          &lt;argument&gt;junit:target/cucumber-junit-report/allcukes.xml&lt;/argument&gt;
                          &lt;argument&gt;--plugin&lt;/argument&gt;
                          &lt;argument&gt;pretty&lt;/argument&gt;
                          &lt;argument&gt;--plugin&lt;/argument&gt;
                          &lt;argument&gt;html:target/cucumber-html-report&lt;/argument&gt;
                      &lt;/arguments&gt;
                  &lt;/configuration&gt;
                  &lt;dependencies&gt;
                      &lt;dependency&gt;
                          &lt;groupId&gt;info.cukes&lt;/groupId&gt;
                          &lt;artifactId&gt;cucumber-core&lt;/artifactId&gt;
                          &lt;version&gt;${cucumber-jvm.version}&lt;/version&gt;
                      &lt;/dependency&gt;
                  &lt;/dependencies&gt;
              &lt;/plugin&gt;
          &lt;/plugins&gt;
      &lt;/build&gt;
  
      &lt;dependencies&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;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.seleniumhq.selenium&lt;/groupId&gt;
              &lt;artifactId&gt;selenium-java&lt;/artifactId&gt;
              &lt;version&gt;${selenium.version}&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;info.cukes&lt;/groupId&gt;
              &lt;artifactId&gt;cucumber-picocontainer&lt;/artifactId&gt;
              &lt;version&gt;${cucumber-jvm.version}&lt;/version&gt;
              &lt;scope&gt;test&lt;/scope&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;info.cukes&lt;/groupId&gt;
              &lt;artifactId&gt;cucumber-core&lt;/artifactId&gt;
              &lt;version&gt;${cucumber-jvm.version}&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;info.cukes&lt;/groupId&gt;
              &lt;artifactId&gt;cucumber-junit&lt;/artifactId&gt;
              &lt;version&gt;${cucumber-jvm.version}&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;!-- http://mvnrepository.com/artifact/info.cukes/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;${cucumber-jvm.version}&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.testng&lt;/groupId&gt;
              &lt;artifactId&gt;testng&lt;/artifactId&gt;
              &lt;version&gt;6.8.7&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;log4j&lt;/groupId&gt;
              &lt;artifactId&gt;log4j&lt;/artifactId&gt;
              &lt;version&gt;1.2.16&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;commons-logging&lt;/groupId&gt;
              &lt;artifactId&gt;commons-logging&lt;/artifactId&gt;
              &lt;version&gt;1.2&lt;/version&gt;
          &lt;/dependency&gt;
      &lt;/dependencies&gt;
  &lt;/project&gt;
  </code></pre>
  
  <p>Any help would be appreciated!</p>