import org.junit.Assert

subprojects {
    apply plugin: 'base'
    configurations {
        'default'
    }
    task jar(type: Jar)
    artifacts {
        'default' jar
    }
}

project('a') {
    dependencies {
        'default' project(':b')
    }
    task listJars {
        dependsOn configurations['default']
        doFirst {
            def jars = configurations['default'].collect { it.name } as Set
            Assert.assertEquals(['b.jar', 'c.jar'] as Set, jars)
        }
    }
}

project('b') {
    dependencies {
        'default' project(':c')
    }
}

project('c') {
    dependencies {
        'default' project(':b')
    }
}