Skip to content

Commit 9ee9a14

Browse files
pkubowiczmpkorstanje
authored andcommitted
Simplify Gradle example (cucumber#1394)
[Examples] Simplify Gradle example
1 parent 51cf389 commit 9ee9a14

File tree

2 files changed

+5
-13
lines changed

2 files changed

+5
-13
lines changed

examples/java-gradle/README.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,10 @@ If you're writing your step definitions in Java then the Gradle script needs to
2828

2929
Here are some caveats:
3030

31-
* The `cucumber` task has to depend on `compileTestJava` task in order to compile test sources
31+
* The `cucumber` task has to depend on `testClasses` task in order to compile test sources
3232

3333
```groovy
34-
task cucumber() {
35-
dependsOn assemble, compileTestJava
34+
task cucumber(dependsOn: testClasses) {
3635
...
3736
}
3837
```
@@ -41,7 +40,7 @@ Here are some caveats:
4140
Otherwise Cucumber-JVM will not find your production classes/resources and step definitions respectively.
4241

4342
```groovy
44-
classpath = configurations.cucumberRuntime + sourceSets.main.output + sourceSets.test.output
43+
classpath = configurations.testRuntimeClasspath + sourceSets.main.output + sourceSets.test.output
4544
```
4645

4746
* Cucumber's `--glue` should be set to your package name (e.g. `gradle.cucumber`) and **NOT** to `src/test/java`

examples/java-gradle/build.gradle

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,10 @@
11
apply plugin: 'java'
22

3-
configurations {
4-
cucumberRuntime {
5-
extendsFrom testRuntime
6-
}
7-
}
8-
9-
task cucumber() {
10-
dependsOn assemble, compileTestJava
3+
task cucumber(dependsOn: testClasses) {
114
doLast {
125
javaexec {
136
main = "cucumber.api.cli.Main"
14-
classpath = configurations.cucumberRuntime + sourceSets.main.output + sourceSets.test.output
7+
classpath = configurations.testRuntimeClasspath + sourceSets.main.output + sourceSets.test.output
158
args = ['--plugin', 'pretty', '--glue', 'gradle.cucumber', 'src/test/resources']
169
}
1710
}

0 commit comments

Comments
 (0)