JavaPluginConvention convention = getProject().getConvention().getPlugin(JavaPluginConvention.class);
if (convention == null || !getProject().getPlugins().hasPlugin(GroovyBasePlugin.class)) {
thrownewGradleException("You must apply the groovy plugin before the spotless plugin if you are using the groovy extension.");