How to use the instantiator to create a named domain object?

I am trying to have a domain object container and use the instantiator to create the domain objects. The problem is that I get a “no such constructor” message.

Here is a code snippet (let me know if I should come with a full repro case).

class ModelleratorExtension {
    final Property<String> toolVersion
    final Property<String> ontologyType
    final ListProperty<String> modelAspects
    final NamedDomainObjectContainer<GeneratedArtifactConfig> generatedArtifacts

    ModelleratorExtension(Project project) {
        this.toolVersion =
        this.ontologyType =
        this.modelAspects = project.objects.listProperty(String)
        this.generatedArtifacts = project.container(GeneratedArtifactConfig) { name ->
            def ga = project.objects.newInstance(GeneratedArtifactConfig, name)
            return ga

    void generatedArtifacts(Closure config) {

class GeneratedArtifactConfig {
    final String name
    final Property<String> ontologyType
    final ListProperty<String> modelAspectTypes
    final RegularFileProperty template
    final Property<TextResource> entities
    final ListProperty<GeneratedArtifactConfig> dependsOn

    GeneratedArtifactConfig(String name, ObjectFactory obf, ProjectLayout prl) { = name
        ontologyType =
        modelAspectTypes = obf.listProperty(String)
        template = prl.fileProperty()
        entities =
        dependsOn = obf.listProperty(GeneratedArtifactConfig)


Dependency injection is not yet supported by the object factory, though it would be really useful. Would you mind opening an issue for that?