samueltbrown / gradle-cucumber-plugin

Plugin to support cucumber-jvm in Gradle builds
MIT License
79 stars 44 forks source link

Passing jvm arguments to cucumber task #53

Open Darkvater opened 8 years ago

Darkvater commented 8 years ago

How do I set task properties to the cucumber task from outside the cucumber block?

Normally one would do it like this:


cucumber {

  jvmOptions.systemProperties += ["foo": "bar"]

}

But if I want to set properties globally through 'withType' for example, it doesn't work. None of the below gets picked up.


tasks.withType(Test) {task ->

  task.systemProperty('foo', 'bar')

}

tasks.withType(JavaExec) {task ->

  task.systemProperty('foo', 'bar')

}

The only way I have gotten this to work is to set a system and not task property on Test, e.g. after which I can use retrieve this value inside the cucumber task from System.getProperty()


tasks.withType(Test) {task ->

  System.setProperty('foo', 'bar')

}

Why are task properties not propagated?

tommywo commented 8 years ago

can you try using tasks.withType(CucumberTask) ? (u might need to import com.excella.gradle.cucumber.tasks.CucumberTask)