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

This sample shows how transitive dependencies work with Java projects in Gradle.

The application project has an implementation dependency on the utilities project:

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

repositories {
    jcenter()
}

dependencies {
    implementation 'org.codehaus.groovy:groovy-all:2.5.7'
    implementation project(':utilities')
}

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

repositories {
    jcenter()
}

dependencies {
    implementation("org.codehaus.groovy:groovy-all:2.5.7")
    implementation(project(":utilities"))
}

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

Which in turn has an API dependency on the list project:

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

repositories {
    jcenter()
}

dependencies {
    compile project(':list')
    implementation 'org.codehaus.groovy:groovy-all:2.5.7'
}
utilities/build.gradle.kts
plugins {
    groovy
}

repositories {
    jcenter()
}

dependencies {
    compile(project(":list"))
    implementation("org.codehaus.groovy:groovy-all:2.5.7")
}

To build the projects, you simply needs to build the application:

$ ./gradlew :application:run

> Task :application:run
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.codehaus.groovy.vmplugin.v7.Java7$1 (file:/usr/local/Cellar/gradle/5.6.2/libexec/lib/groovy-all-1.3-2.5.4.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
Hello, World!

BUILD SUCCESSFUL in 3s
6 actionable tasks: 6 executed

For more information, see dependency management chapters.