If I have a multiple projects in gradle, there are project1 .. project10. And all depends on java plugin except project10. How to do that?
I am planning to use subprojects but then it will apply to project10 as well. so how exclude it?
With multi-project builds this becomes possible because each subproject contains its own source code and configuration. Not only can you create a different jar file based on different source code, but you could just as easily setup a subproject to compile Kotlin, Scala, Groovy, or even C++.
There are two general types of plugins in Gradle, binary plugins and script plugins.
The Java Gradle Plugin development plugin can be used to assist in the development of Gradle plugins. It automatically applies the Java Library plugin, adds the gradleApi() dependency to the api configuration and performs validation of plugin metadata during jar task execution.
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'
}
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")
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With