class DefaultModelBuildingListener implements ModelBuildingListener {

    private final MavenProject project;

    private final ProjectBuildingHelper projectBuildingHelper;

    private final ProjectBuildingRequest projectBuildingRequest;

    private List<ArtifactRepository> remoteRepositories;

    private List<ArtifactRepository> pluginRepositories;

    public DefaultModelBuildingListener(
            MavenProject project,
            ProjectBuildingHelper projectBuildingHelper,
            ProjectBuildingRequest projectBuildingRequest) {
        this.project = Objects.requireNonNull(project, "project cannot be null");
        this.projectBuildingHelper =
                Objects.requireNonNull(projectBuildingHelper, "projectBuildingHelper cannot be null");
        this.projectBuildingRequest =
                Objects.requireNonNull(projectBuildingRequest, "projectBuildingRequest cannot be null");
        this.remoteRepositories = projectBuildingRequest.getRemoteRepositories();
        this.pluginRepositories = projectBuildingRequest.getPluginArtifactRepositories();
    }

    /**
     * Gets the project whose model is being built.
     *
     * @return The project, never {@code null}.
     */
    public MavenProject getProject() {
        return project;
    }

    @Override
    public void buildExtensionsAssembled(ModelBuildingEvent event) {<FILL_FUNCTION_BODY>}
}

        Model model = new Model(event.model());

        try {
            pluginRepositories = projectBuildingHelper.createArtifactRepositories(
                    model.getPluginRepositories(), pluginRepositories, projectBuildingRequest);
        } catch (Exception e) {
            event.problems()
                    .add(
                            BuilderProblem.Severity.ERROR,
                            ModelProblem.Version.BASE,
                            "Invalid plugin repository: " + e.getMessage(),
                            e);
        }
        project.setPluginArtifactRepositories(pluginRepositories);

        if (event.request().isProcessPlugins()) {
            try {
                ProjectRealmCache.CacheRecord record =
                        projectBuildingHelper.createProjectRealm(project, model, projectBuildingRequest);

                project.setClassRealm(record.getRealm());
                project.setExtensionDependencyFilter(record.getExtensionArtifactFilter());
            } catch (PluginResolutionException | PluginManagerException | PluginVersionResolutionException e) {
                event.problems()
                        .add(
                                BuilderProblem.Severity.ERROR,
                                ModelProblem.Version.BASE,
                                "Unresolvable build extension: " + e.getMessage(),
                                e);
            }

            projectBuildingHelper.selectProjectRealm(project);
        }

        // build the regular repos after extensions are loaded to allow for custom layouts
        try {
            remoteRepositories = projectBuildingHelper.createArtifactRepositories(
                    model.getRepositories(), remoteRepositories, projectBuildingRequest);
        } catch (Exception e) {
            event.problems()
                    .add(
                            BuilderProblem.Severity.ERROR,
                            ModelProblem.Version.BASE,
                            "Invalid artifact repository: " + e.getMessage(),
                            e);
        }
        project.setRemoteArtifactRepositories(remoteRepositories);

        if (model.getDelegate() != event.model()) {
            event.update().accept(model.getDelegate());
        }
    
<no_super_class>