Better change the comment to “Be sure that all projects have the ‘java’ plugin applied by the time this is configured”
One way to achieve this would be to put it at the end of the main build script, another - to put it in afterEvaluate
block.
See https://docs.gradle.org/current/userguide/build_lifecycle.html#N11BAE