title: Passing in tags to Gradle cucumber task
body: <p>I know that we can pass cucumber tags to Gradle by specifying the following in build.gradle file:</p>
  
  <pre><code>test {
      systemProperty "cucumber.options", System.getProperty("cucumber.options")
  }
  </code></pre>
  
  <p>So when you run <code>gradlew test -Dcucumber.options="--tags @CDC"</code> it will only runs scenarios with CDC tag.</p>
  
  <p>But my question is whether I can pass the cucumber options to the cucumber task. The reason I need to do this is because my cucumber task creates a JSON file after running the task, and I'm using gradle-cucumber-reporting plugin (<a href="https://github.com/SpacialCircumstances/gradle-cucumber-reporting" rel="nofollow noreferrer">https://github.com/SpacialCircumstances/gradle-cucumber-reporting</a>) to generate a report based on the JSON file.</p>
  
  <p>cucumber task</p>
  
  <pre><code>task cucumber() {
      dependsOn assemble, compileTestJava
      doLast {
          javaexec {
              main = "io.cucumber.core.cli.Main"
              classpath = configurations.cucumberRuntime + sourceSets.main.output + sourceSets.test.output
              args = [
              '--plugin', 'html:cucumber-report',
              '--plugin', 'json:cucumber.json', //generates a .json report file
              '--plugin', 'pretty',
              '--plugin', 'usage:cucumber-usage.json',
              '--glue', 'hellocucumber', 'src/test/resources']
          }
      }
  }
  </code></pre>
  
  <p>Running the <code>test</code> task in Gradle doesn't update the JSON file.</p>
  
  <p>Here's the snippet for gradle-cucumber-reporting:</p>
  
  <pre><code>cucumberReports {
    outputDir = file('cucumber-pretty-report')
    buildId = '0'
    reports = files('cucumber.json')
  }
  </code></pre>