Hi!
I’m working on a multi-project build and we’re currently migrating from gradle 6 to 7.6.1 .
Previously all the subprojects with java code had apply plugin: 'java'
, now most are apply plugin: 'java-library'
, with some still having apply plugin: 'java'
(those that are not libaries).
There are a bunch of configs, that are blanket-applied to all subprojects, with an additional check if it’s a java project or not, e.g.:
plugins.withType(JavaPlugin).all {
logger.debug "Configuring default values for plugin 'JavaPlugin' in $project"
// all java projects should have code analysis
project.apply plugin: 'com.github.spotbugs'
project.apply plugin: 'pmd'
project.apply plugin: 'jacoco'
}
Now my question is: I noticed that JavaBasePlugin exists and now I’m unsure on what to use where or if I can just leave those configs as-is (I know, I can switch to configureEach etcpp, but for now I just want to know about JavaBasePlugin).
According to the Gradle source, JavaBasePlugin and JavaPlugin seem to be unrelated to each other(in terms of the java class hierarchy) but the javadoc seems to be pretty much the same (gradle/JavaPlugin.java at master · gradle/gradle · GitHub vs gradle/JavaBasePlugin.java at master · gradle/gradle · GitHub). What is the difference? What should I use?