Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- name: 'Set up JDK'
uses: actions/setup-java@v5
with:
java-version: 8
java-version: 17
distribution: temurin
- name: Init Gradle Build Action
uses: gradle/actions/setup-gradle@v5
Expand All @@ -38,7 +38,7 @@ jobs:
- name: 'Set up JDK'
uses: actions/setup-java@v5
with:
java-version: 8
java-version: 17
distribution: temurin
- name: 'Check Spock'
run: |
Expand All @@ -57,7 +57,7 @@ jobs:
- name: 'Set up JDK'
uses: actions/setup-java@v5
with:
java-version: 8
java-version: 17
distribution: temurin
- name: 'Check Spock'
run: |
Expand Down
8 changes: 6 additions & 2 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,17 @@ All builds (Gradle and Maven) will automatically download all required dependenc

=== Prerequisites

- JDK 8 or higher
- JDK 17 or higher
- Maven use `mvnw` wrapper
- Gradle use `gradlew` wrapper

NOTE: This example shows the usage of Spock 2.0, which uses the JUnit Platform. If you want to see how to get Spock 1.x with JUnit 4 up and running see the https://github.com/spockframework/spock-example/tree/spock-1.x[Spock-1.x] Branch.

NOTE: Spock supports Java 8, but Groovy 5.0 requires Java 11+ and Gradle 9+ requires Java 17+.
So for simplicity’s sake the example uses Java 17.
If you want to use an older Java version, please use an older Gradle version (e.g. Gradle 8.x for Java 8+).
Check the https://github.com/spockframework/spock-example/tree/java-8[Java-8] Branch for the last state of the example with Java 8.

=== Building with Gradle
Type:

Expand Down Expand Up @@ -61,4 +66,3 @@ If you have any comments or questions, please direct them to the Spock discussio
Happy spec'ing!

The Spock Framework Team

8 changes: 5 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ description = "Spock Framework - Example Project"
// Spock works with Java 1.8 and above
java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(8))
languageVersion.set(JavaLanguageVersion.of(17))
}
}

Expand All @@ -21,11 +21,13 @@ repositories {

dependencies {
// mandatory dependencies for using Spock
implementation platform('org.apache.groovy:groovy-bom:4.0.29')
implementation platform('org.apache.groovy:groovy-bom:5.0.3')
implementation 'org.apache.groovy:groovy'
testImplementation platform("org.spockframework:spock-bom:2.3-groovy-4.0")
testImplementation platform("org.spockframework:spock-bom:2.4-groovy-5.0")
testImplementation "org.spockframework:spock-core"
testImplementation "org.spockframework:spock-junit4" // you can remove this if your code does not rely on old JUnit 4 rules
testImplementation(platform('org.junit:junit-bom:6.0.1'))
testRuntimeOnly('org.junit.platform:junit-platform-launcher')

// optional dependencies for using Spock
testImplementation "org.hamcrest:hamcrest-core:3.0" // only necessary if Hamcrest matchers are used
Expand Down
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionSha256Sum=20f1b1176237254a6fc204d8434196fa11a4cfb387567519c61556e8710aed78
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
distributionSha256Sum=72f44c9f8ebcb1af43838f45ee5c4aa9c5444898b3468ab3f4af7b6076c5bc3f
distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
16 changes: 8 additions & 8 deletions ivy.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,22 @@
<publications defaultconf="master"/>

<dependencies defaultconf="compile;sources;javadoc">
<dependency org="org.apache.groovy" name="groovy-ant" rev="4.0.26" conf="groovy-ant;sources;javadoc"/>
<dependency org="org.apache.groovy" name="groovy-groovydoc" rev="4.0.26" conf="groovy-ant;sources;javadoc"/>
<dependency org="org.apache.groovy" name="groovy" rev="4.0.26" conf="test;sources;javadoc"/>
<dependency org="org.apache.groovy" name="groovy-ant" rev="5.0.3" conf="groovy-ant;sources;javadoc"/>
<dependency org="org.apache.groovy" name="groovy-groovydoc" rev="5.0.3" conf="groovy-ant;sources;javadoc"/>
<dependency org="org.apache.groovy" name="groovy" rev="5.0.3" conf="test;sources;javadoc"/>
<!-- Mandatory dependencies for using Spock -->
<dependency org="org.spockframework" name="spock-core" rev="2.3-groovy-4.0" conf="test;sources;javadoc"/>
<dependency org="org.junit.platform" name="junit-platform-launcher" rev="1.12.1" conf="test;sources;javadoc"/>
<dependency org="org.spockframework" name="spock-core" rev="2.4-groovy-5.0" conf="test;sources;javadoc"/>
<dependency org="org.junit.platform" name="junit-platform-launcher" rev="6.0.1" conf="test;sources;javadoc"/>
<!-- Optional dependencies for using Spock -->
<!-- enables mocking of classes (in addition to interfaces) -->
<dependency org="org.objenesis" name="objenesis" rev="3.4" conf="test;sources;javadoc"/>
<dependency org="net.bytebuddy" name="byte-buddy" rev="1.17.5" conf="test;sources;javadoc"/>
<!-- Dependencies used by examples in this project (not required for using Spock) -->
<dependency org="org.apache.groovy" name="groovy-sql" rev="4.0.26" conf="test;sources;javadoc"/>
<dependency org="org.spockframework" name="spock-junit4" rev="2.3-groovy-4.0" conf="test;sources;javadoc"/>
<dependency org="org.apache.groovy" name="groovy-sql" rev="5.0.3" conf="test;sources;javadoc"/>
<dependency org="org.spockframework" name="spock-junit4" rev="2.4-groovy-5.0" conf="test;sources;javadoc"/>
<dependency org="com.h2database" name="h2" rev="2.2.224" conf="test;sources;javadoc"/>
<!-- For using the scriptselector with Groovy -->
<dependency org="org.apache.groovy" name="groovy-jsr223" rev="4.0.26" conf="groovy-script;sources;javadoc"/>
<dependency org="org.apache.groovy" name="groovy-jsr223" rev="5.0.3" conf="groovy-script;sources;javadoc"/>
<dependency org="org.ow2.asm" name="asm" rev="9.8" conf="groovy-script;sources;javadoc"/>
</dependencies>
</ivy-module>
15 changes: 13 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<groovy.version>4.0.29</groovy.version>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<spock.version>2.4-groovy-5.0</spock.version>
<groovy.version>5.0.3</groovy.version>
<junit.version>6.0.1</junit.version>
</properties>

<build>
Expand Down Expand Up @@ -69,10 +73,17 @@
<dependency>
<groupId>org.spockframework</groupId>
<artifactId>spock-bom</artifactId>
<version>2.3-groovy-4.0</version>
<version>${spock.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.junit</groupId>
<artifactId>junit-bom</artifactId>
<version>${junit.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>

Expand Down