Apply different plugins depending on the java version


I want to apply a different plugin depending on which JDK version is being used. More specifically:
if (JavaVersion.current() == JavaVersion.VERSION_1_8) {
apply plugin: ‘net.ltgt.errorprone’
} else {
apply plugin: ‘net.ltgt.errorprone-javacplugin’

This works fine, but now I’d like to get this working in the new plugins{} structure. I can’t figure out how to use any logic there. Would that be possible?

1 Like

That is not currently possible: See

Your solution is still the best.

NOTE: At this point (v4.9) you will not be able to use pluginManagement.resolutionStrategy in settings.gradle either as it only allows for changing the artifact, nit the plugin id.