{"record":{"id":"8fd3b5d3010e51df","repo":"apache/maven","slug":"found-duplicated-phase-in-lifecycle","errorCode":null,"errorMessage":"Found duplicated phase '{}' in '{}' lifecycle","messagePattern":"Found duplicated phase '(.+?)' in '(.+?)' lifecycle","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"critical","filePath":"impl/maven-core/src/main/java/org/apache/maven/internal/impl/DefaultLifecycleRegistry.java","lineNumber":118,"sourceCode":"    public static final String SCOPE_TEST = DependencyScope.TEST.id();\n\n    private final List<LifecycleProvider> providers;\n\n    public DefaultLifecycleRegistry() {\n        this(Collections.emptyList());\n    }\n\n    @Inject\n    public DefaultLifecycleRegistry(List<LifecycleProvider> providers) {\n        List<LifecycleProvider> p = new ArrayList<>(providers);\n        p.add(() -> List.of(new CleanLifecycle(), new DefaultLifecycle(), new SiteLifecycle()));\n        this.providers = p;\n        // validate lifecycle\n        for (Lifecycle lifecycle : this) {\n            Set<String> set = new HashSet<>();\n            lifecycle.allPhases().forEach(phase -> {\n                if (!set.add(phase.name())) {\n                    throw new IllegalArgumentException(\n                            \"Found duplicated phase '\" + phase.name() + \"' in '\" + lifecycle.id() + \"' lifecycle\");\n                }\n            });\n        }\n    }\n\n    static String getImplementationVersion(Class<?> clazz) {\n        Package packageInfo = clazz.getPackage();\n        return packageInfo != null ? packageInfo.getImplementationVersion() : null;\n    }\n\n    @Override\n    public Iterator<Lifecycle> iterator() {\n        return stream().toList().iterator();\n    }\n\n    @Override\n    public Stream<Lifecycle> stream() {","sourceCodeStart":100,"sourceCodeEnd":136,"githubUrl":"https://github.com/apache/maven/blob/e4093d4e120eac99d6bdce5ba67cace2f3085c97/impl/maven-core/src/main/java/org/apache/maven/internal/impl/DefaultLifecycleRegistry.java#L100-L136","documentation":"IllegalArgumentException thrown from DefaultLifecycleRegistry's constructor while validating every registered lifecycle: within a single lifecycle, a phase name may appear only once. Because this fires during Sisu component wiring at container startup, a duplicate poisons the whole container — Maven fails before any project builds.","triggerScenarios":"A LifecycleProvider (typically a plugin contributing custom packaging/lifecycles via its descriptor's lifecycle mappings) returns phases whose name() duplicates another phase in the same lifecycle id — e.g. a custom packaging re-declaring 'compile' or copying the default lifecycle's phases into its own list.","commonSituations":"Custom packaging plugins with hand-written lifecycle definitions; upgrading Maven major versions where provider APIs changed and previously-shadowed mappings now collide with built-in lifecycles (default, clean, site).","solutions":["Open the failing lifecycle (its id is in the message); in the contributing plugin's lifecycle mapping, remove or rename the duplicated phase","Reference built-in phases instead of re-declaring them in a custom lifecycle","Pin or upgrade the plugin that contributes the custom lifecycle to a version built for the Maven version in use"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Validate a custom lifecycle definition before contributing it\nSet<String> seen = new HashSet<>();\nfor (Phase phase : customLifecycle.allPhases()) {\n    if (!seen.add(phase.name())) {\n        throw new IllegalArgumentException(\n            \"duplicate phase '\" + phase.name() + \"' in lifecycle \" + customLifecycle.id());\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Lint plugin lifecycle mappings for duplicate phase names in CI","Do not copy built-in default/clean/site phases into custom packagings; reference them","Test custom-packaging plugins against the exact Maven version on container startup before release"],"tags":["maven","lifecycle","plugin-packaging","container-startup","sisu"],"backgroundTag":"duplicate-lifecycle-phase","analyzedSha":"e4093d4e120eac99d6bdce5ba67cace2f3085c97","analyzedAt":"2026-08-21T22:58:24.034Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}