You can open the samples inside an IDE using the IntelliJ native importer or Eclipse Buildship.

This sample shows how to test Groovy projects using Spock Framework in Gradle.

Applications can be configured as follow:

application/build.gradle
plugins {
    id 'groovy'
    id 'application'
}

repositories {
    jcenter()
}

dependencies {
    implementation project(':library')
    implementation 'org.codehaus.groovy:groovy-all:2.5.7'
    testImplementation 'org.spockframework:spock-core:1.3-groovy-2.5'
}

application {
    mainClassName = 'org.gradle.sample.Main'
}
application/build.gradle.kts
plugins {
    groovy
    application
}

repositories {
    jcenter()
}

dependencies {
    implementation(project(":library"))
    implementation("org.codehaus.groovy:groovy-all:2.5.7")
    testImplementation("org.spockframework:spock-core:1.3-groovy-2.5")
}

application {
    mainClassName = "org.gradle.sample.Main"
}

Libraries can be configured as follow:

library/build.gradle
plugins {
    id 'groovy'
}

repositories {
    jcenter()
}

dependencies {
    implementation 'org.codehaus.groovy:groovy-all:2.5.7'
    testImplementation 'org.spockframework:spock-core:1.3-groovy-2.5'
}
library/build.gradle.kts
plugins {
    groovy
}

repositories {
    jcenter()
}

dependencies {
    implementation("org.codehaus.groovy:groovy-all:2.5.7")
    testImplementation("org.spockframework:spock-core:1.3-groovy-2.5")
}

To test the projects:

$ ./gradlew test

> Task :application:test
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.codehaus.groovy.vmplugin.v7.Java7$1 (file:/Users/daniel/.gradle/caches/modules-2/files-2.1/org.codehaus.groovy/groovy/2.5.7/99907efe4b69f800c42584386f5d668e4d952bd5/groovy-2.5.7.jar) to constructor java.lang.invoke.MethodHandles$Lookup(java.lang.Class,int)
WARNING: Please consider reporting this to the maintainers of org.codehaus.groovy.vmplugin.v7.Java7$1
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release

> Task :library:test
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.codehaus.groovy.vmplugin.v7.Java7$1 (file:/Users/daniel/.gradle/caches/modules-2/files-2.1/org.codehaus.groovy/groovy/2.5.7/99907efe4b69f800c42584386f5d668e4d952bd5/groovy-2.5.7.jar) to constructor java.lang.invoke.MethodHandles$Lookup(java.lang.Class,int)
WARNING: Please consider reporting this to the maintainers of org.codehaus.groovy.vmplugin.v7.Java7$1
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release

BUILD SUCCESSFUL in 5s
7 actionable tasks: 7 executed

For more information, see Testing in JVM project chapter. You can also get started quickly using the Build Init Plugin.