gnodet commented on code in PR #1524: URL: https://github.com/apache/maven/pull/1524#discussion_r1607989007
########## maven-core/src/main/java/org/apache/maven/internal/impl/DefaultLifecycleRegistry.java: ########## @@ -78,37 +83,44 @@ public DefaultLifecycleRegistry( @Override public Iterator<Lifecycle> iterator() { - return values.values().iterator(); + return stream().toList().iterator(); } @Override public Stream<Lifecycle> stream() { - return values.values().stream(); - } - - static <T> List<T> concat(List<T> l, T t) { - List<T> nl = new ArrayList<>(l.size() + 1); - nl.addAll(l); - nl.add(t); - return nl; + return providers.stream().map(ExtensibleEnumProvider::provides).flatMap(Collection::stream); } @Override - public List<String> computePhases(Lifecycle lifecycle) { - return lifecycle.phases().stream().map(Lifecycle.Phase::name).toList(); + public Optional<Lifecycle> lookup(String id) { + return Optional.empty(); } - static class LifecycleWrapperProvider implements LifecycleProvider { - private final Map<String, org.apache.maven.lifecycle.Lifecycle> lifecycles; + @Named + @Singleton + public static class LifecycleWrapperProvider implements LifecycleProvider { + private final PlexusContainer container; @Inject - LifecycleWrapperProvider(Map<String, org.apache.maven.lifecycle.Lifecycle> lifecycles) { - this.lifecycles = lifecycles; + public LifecycleWrapperProvider(PlexusContainer container) { + this.container = container; } @Override public Collection<Lifecycle> provides() { - return lifecycles.values().stream().map(this::wrap).collect(Collectors.toList()); + try { + Map<String, org.apache.maven.lifecycle.Lifecycle> all = + container.lookupMap(org.apache.maven.lifecycle.Lifecycle.class); + return all.keySet().stream() + .filter(id -> !Lifecycle.CLEAN.equals(id) Review Comment: Actually, I can't use the instance to detect, as getting the instance will cause the lookup error: the map is lazily managed by sisu, and the instance is created when requested only, but that's what causes the lookup error. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@maven.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org