Inhouse Conventions for Standard Plugins , Implementation Pattern

I want to write a Inhouse specific strongly opinated Plugin, which shortcuts and supplies in-house defaults for the standard MavenPlugin. Additionally it is also a requirement that the developer is able to “overwrite” the defaults values, where it makes sense.

So i looked for guidance in the https://github.com/gradle-guides and specifically https://github.com/gradle-guides/implementing-gradle-plugins/blob/master/samples/code/react-to-plugin/buildSrc/src/main/java/InhouseConventionJavaPlugin.java

This was a good starting point. The convention for the Java sourceSets is enforced with

SourceSet main = javaConvention.getSourceSets().getByName(SourceSet.MAIN_SOURCE_SET_NAME);
                main.getJava().setSrcDirs(Arrays.asList("src"));

Now, for my scenario the developer should be able to “overrule” this convention: it should be a default, which can be changed.

So I added a Extension Class for the Plugin and moved the above SourceSet configuration to a method configure() the Extension Class:

public void configure() {
        JavaPluginConvention javaConvention =
                project.getConvention().getPlugin(JavaPluginConvention.class);
            SourceSet main = javaConvention.getSourceSets().getByName(SourceSet.MAIN_SOURCE_SET_NAME);
            main.getJava().setSrcDirs(Arrays.asList(sourceDir));
	}

In the Plugin class i only apply the JavaPlugin and create the Extension “javaConventions” with the Project instance as constructor arg:

public void apply(Project project) {
		final ExtensionContainer ext = project.getExtensions();
		final PluginContainer plugins = project.getPlugins();
		plugins.apply(JavaPlugin.class);
		ext.create("javaConventions", InhouseConventionJavaExtension.class, project);
	}

It seems to work fine, for the following build.gradle i get the expected output:

apply plugin: extensiontest.InhouseConventionJavaPlugin
javaConventions {
	configure()

}
println sourceSets.main.java.srcDirs
javaConventions.sourceDir = "src/main/java"
println sourceSets.main.java.srcDirs
javaConventions.configure()
println sourceSets.main.java.srcDirs

My question: Is this a valid pattern to provide reasonable defaults, but which can be changed, for Grade Plugins, for example the MavenPlugin? What disturbs me with this solution is the necessity of javaConventions.configure(). Are there better way to achieve the same?

Any input, feedback, options greatly appreciated