Why there is a circular dependency here

Hi I am using Gradle 4.5 in a multimodule project, and I am getting a circular dependency error but I cannot find why. The build.gradle file looks like:

project(':gamepage:impl') {
    apply plugin: 'war'

    war {
        archiveName 'game.war'
    }

    dependencies {
        compileOnly 'javax:javaee-api:7.0'
        compile project (':gamepage:api')
        compile project(':details:impl')
    }
}

project(':gamepage:api') {
    apply plugin: 'java'
}

project(':details:impl') {
    apply plugin: 'java'

    dependencies {
        compile project(':details:api')
    }
}

project(':details:api') {
    apply plugin: 'java'
}

project(':ratings:api') {
    apply plugin: 'java'
}

project(':ratings:impl') {
    apply plugin: 'java'
}

project(':reviews:api') {
    apply plugin: 'java'
}

project(':reviews:impl') {
    apply plugin: 'java'
}

And I get the next output:

  • What went wrong:
    Circular dependency between the following tasks:
    :gamepage:impl:classes
    — :gamepage:impl:compileJava
    — :gamepage:impl:jar
    — :gamepage:impl:classes (*)

(*) - details omitted (listed previously)

But no idea why this is happening.

Fixed by playing with runtime and compile scopes.