I’m currently converting an ant project to gradle. There 40 something subprojects (all java) and one root project. I read about the java-platform plugin and now I’m trying to define the dependency versions with a platform project.
If I add a project with an “java-platform” plugin applied, I get an error the project can only use “java” or “java-platform”
Does this mean, that I have to move the apply(plugin = “java”) to every subproject except the platform project or do I misunderstand how the platform project is used?
Hi, I can’t call myself an expert but here’s one idea
The ‘subprojects’ block is a way of making common specifications across all sub-projects, but if one of those contradicts another specification (like a plugin) in a given sub-project, then I can think of two solutions:
As you suggest, stop applying the plugin centrally, and instead repeat it in each sub-project (except the ones that need to be different)
Make an exception in the top-level project for the sub-projects that need to be different
The second option could be done by replacing the subprojects { block with something like this: