class DefaultPackagingRegistry
        extends ExtensibleEnumRegistries.DefaultExtensibleEnumRegistry<Packaging, PackagingProvider>
        implements PackagingRegistry {

    private static final Logger LOGGER = LoggerFactory.getLogger(DefaultPackagingRegistry.class);

    private final Lookup lookup;

    private final TypeRegistry typeRegistry;

    @Inject
    public DefaultPackagingRegistry(Lookup lookup, TypeRegistry typeRegistry, List<PackagingProvider> providers) {
        super(providers);
        this.lookup = lookup;
        this.typeRegistry = typeRegistry;
    }

    @Override
    public Optional<Packaging> lookup(String id) {<FILL_FUNCTION_BODY>}

    private Map<String, PluginContainer> getPlugins(LifecycleMapping lifecycleMapping) {
        Map<String, PluginContainer> lfs = new HashMap<>();
        lifecycleMapping.getLifecycles().forEach((id, lifecycle) -> {
            Map<String, Plugin> plugins = new HashMap<>();
            lifecycle
                    .getLifecyclePhases()
                    .forEach((phase, lifecyclePhase) -> parseLifecyclePhaseDefinitions(plugins, phase, lifecyclePhase));
            lfs.put(id, PluginContainer.newBuilder().plugins(plugins.values()).build());
        });
        return lfs;
    }

    private void parseLifecyclePhaseDefinitions(Map<String, Plugin> plugins, String phase, LifecyclePhase goals) {
        InputSource inputSource =
                new InputSource(DefaultLifecyclePluginAnalyzer.DEFAULTLIFECYCLEBINDINGS_MODELID, null);
        InputLocation location = new InputLocation(-1, -1, inputSource, 0);

        List<LifecycleMojo> mojos = goals.getMojos();
        if (mojos != null) {
            for (int i = 0; i < mojos.size(); i++) {
                LifecycleMojo mojo = mojos.get(i);

                // Compute goal coordinates
                String groupId, artifactId, version, goal;
                String[] p = mojo.getGoal().trim().split(":");
                if (p.length == 3) {
                    // <groupId>:<artifactId>:<goal>
                    groupId = p[0];
                    artifactId = p[1];
                    version = null;
                    goal = p[2];
                } else if (p.length == 4) {
                    // <groupId>:<artifactId>:<version>:<goal>
                    groupId = p[0];
                    artifactId = p[1];
                    version = p[2];
                    goal = p[3];
                } else {
                    // invalid
                    LOGGER.warn(
                            "Ignored invalid goal specification '{}' from lifecycle mapping for phase {}",
                            mojo.getGoal(),
                            phase);
                    continue;
                }

                String key = groupId + ":" + artifactId;

                // Build plugin
                List<PluginExecution> execs = new ArrayList<>();
                List<Dependency> deps = new ArrayList<>();

                Plugin existing = plugins.get(key);
                if (existing != null) {
                    if (version == null) {
                        version = existing.getVersion();
                    }
                    execs.addAll(existing.getExecutions());
                    deps.addAll(existing.getDependencies());
                }

                PluginExecution execution = PluginExecution.newBuilder()
                        .id(getExecutionId(existing, goal))
                        .priority(i - mojos.size())
                        .phase(phase)
                        .goals(List.of(goal))
                        .configuration(mojo.getConfiguration())
                        .location("", location)
                        .location("id", location)
                        .location("phase", location)
                        .location("goals", location)
                        .build();
                execs.add(execution);

                if (mojo.getDependencies() != null) {
                    mojo.getDependencies().forEach(d -> deps.add(d.getDelegate()));
                }

                Plugin plugin = Plugin.newBuilder()
                        .groupId(groupId)
                        .artifactId(artifactId)
                        .version(version)
                        .location("", location)
                        .location("groupId", location)
                        .location("artifactId", location)
                        .location("version", location)
                        .executions(execs)
                        .dependencies(deps)
                        .build();

                plugins.put(key, plugin);
            }
        }
    }

    private static String getExecutionId(Plugin plugin, String goal) {
        Set<String> existingIds = plugin != null
                ? plugin.getExecutions().stream().map(PluginExecution::getId).collect(Collectors.toSet())
                : Set.of();
        String base = "default-" + goal;
        String id = base;
        for (int index = 1; existingIds.contains(id); index++) {
            id = base + '-' + index;
        }
        return id;
    }

    private record DefaultPackaging(String id, Type type, Map<String, PluginContainer> plugins) implements Packaging {}
}

        id = id.toLowerCase(Locale.ROOT);
        // TODO: we should be able to inject a Map<String, LifecycleMapping> directly,
        // however, SISU visibility filtering can only happen when an explicit
        // lookup is performed. The whole problem here is caused by "project extensions"
        // which are bound to a project's classloader, without any clear definition
        // of a "project scope"
        LifecycleMapping lifecycleMapping =
                lookup.lookupOptional(LifecycleMapping.class, id).orElse(null);
        if (lifecycleMapping == null) {
            return Optional.empty();
        }
        Type type = typeRegistry.lookup(id).orElse(null);
        if (type == null) {
            return Optional.empty();
        }
        return Optional.of(new DefaultPackaging(id, type, getPlugins(lifecycleMapping)));
    
<methods>public Optional<org.apache.maven.api.Packaging> lookup(java.lang.String) <variables>protected final non-sealed Map<java.lang.String,org.apache.maven.api.Packaging> values