Linked Questions

Popular Questions

Since Gradle 4.6:

new configurations were added: api (only in java-library plugin) & implementation (defined by both).

In multi-module project I have several "core" modules that act as internal libraries and sometimes need to pass exposed compile time dependencies via api configuration.

Previously we applied java plugin recursively:

subprojects {
    apply plugin: 'java'
}

To be purist we can apply java-library plugin to "library" modules and java plugin to "end-application" modules.

What if we just put:

subprojects {
    apply plugin: 'java'
    apply plugin: 'java-library'
}

NOTE With proper naming schema (we don't have one) it is possible to do selectively:

subprojects {
    if (project.name.startsWith('lib-')) {
        apply plugin: 'java-library'
    } else {
        apply plugin: 'java'
    }
}

Related Questions