how to apply java plugin too all projects except one special projects?

Except several projects:

configure(subprojects.findAll {
    !listOf("project2", "project5").contains(it.name)
}) {
    apply plugin: 'java'
}

On Kotlin DSL:

configure(subprojects.filter {
    !listOf("project2", "project5").contains(it.name)
}) {
    apply(plugin = "org.jetbrains.kotlin.plugin.spring")
}

Haven't tested it but seems like you will be able to filter by name:

Subproject configuration - base on the Filtering by name section, you should be able to do something like this.

configure(subprojects.findAll {it.name != 'project10'}) {
    apply plugin: 'java'
}

Tags:

Gradle