{"record":{"id":"9abd4c01097e4903","repo":"apache/maven","slug":"two-or-more-projects-in-the-reactor-have-the-same","errorCode":null,"errorMessage":"Two or more projects in the reactor have the same identifier, please make sure that <groupId>:<artifactId>:<version> is unique for each project: {}","messagePattern":"Two or more projects in the reactor have the same identifier, please make sure that <groupId>:<artifactId>:<version> is unique for each project: (.+?)","errorType":"exception","errorClass":"DuplicateProjectException","httpStatus":null,"severity":"error","filePath":"impl/maven-core/src/main/java/org/apache/maven/DefaultMaven.java","lineNumber":633,"sourceCode":"\n            MavenProject collision = index.get(projectId);\n\n            if (collision == null) {\n                index.put(projectId, project);\n            } else {\n                List<File> pomFiles = collisions.get(projectId);\n\n                if (pomFiles == null) {\n                    pomFiles = new ArrayList<>(Arrays.asList(collision.getFile(), project.getFile()));\n                    collisions.put(projectId, pomFiles);\n                } else {\n                    pomFiles.add(project.getFile());\n                }\n            }\n        }\n\n        if (!collisions.isEmpty()) {\n            throw new DuplicateProjectException(\n                    \"Two or more projects in the reactor\"\n                            + \" have the same identifier, please make sure that <groupId>:<artifactId>:<version>\"\n                            + \" is unique for each project: \" + collisions,\n                    collisions);\n        }\n\n        return index;\n    }\n\n    private Result<? extends ProjectDependencyGraph> buildGraph(MavenSession session) {\n        Result<? extends ProjectDependencyGraph> graphResult = graphBuilder.build(session);\n        for (ModelProblem problem : graphResult.getProblems()) {\n            if (problem.getSeverity() == ModelProblem.Severity.WARNING) {\n                logger.warn(problem.getMessage());\n            } else {\n                logger.error(problem.getMessage());\n            }\n        }","sourceCodeStart":615,"sourceCodeEnd":651,"githubUrl":"https://github.com/apache/maven/blob/e4093d4e120eac99d6bdce5ba67cace2f3085c97/impl/maven-core/src/main/java/org/apache/maven/DefaultMaven.java#L615-L651","documentation":"While collecting the reactor project index, DefaultMaven groups projects by groupId:artifactId:version and throws DuplicateProjectException when two or more reactor projects share the same GAV; the message prints the collisions map (GAV -> list of offending pom files). Reactor identity must be unique because dependency resolution inside the session keys on it.","triggerScenarios":"The same module reachable twice (e.g. `<module>app</module>` and `<module>./app</module>`); overlapping module paths across profiles; two submodules copy-pasted without changing artifactId; a child POM that fails to override the parent's artifactId.","commonSituations":"Copy-pasted module scaffolds; profile combinations only activated together in CI; restructured repos with stale `<module>` entries; aggregator POMs including a directory both directly and via a wildcard-ish path.","solutions":["Read the message: it lists each duplicated GAV and every pom file involved - open those poms.","Make each module's artifactId (or version) unique, or remove the duplicate/overlapping `<module>` entry.","Check `<modules>` in all profiles for the same path twice; normalize relative paths (drop `./`).","Ensure child modules declare their own artifactId instead of inheriting the parent's.","Run `mvn validate` after restructuring to confirm the reactor is unique."],"exampleFix":"<!-- before: same module reachable twice -->\n<modules>\n  <module>app</module>\n  <module>./app</module>\n</modules>\n\n<!-- after -->\n<modules>\n  <module>app</module>\n</modules>","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    MavenExecutionResult result = maven.execute(request);\n    for (Throwable t : result.getExceptions()) {\n        if (t instanceof DuplicateProjectException dpe) {\n            // dpe.getCollisions() maps GAV -> offending pom files\n            reportDuplicateProjects(dpe.getCollisions());\n        }\n    }\n} catch (DuplicateProjectException dpe) {\n    reportDuplicateProjects(dpe.getCollisions());\n}","preventionTips":["Lint aggregator POMs for duplicate module paths and duplicate child GAVs in CI.","Always set an explicit artifactId in child modules.","Normalize module paths (no `./` prefixes) to avoid accidental double inclusion."],"tags":["maven","reactor","duplicate","gav","multi-module"],"backgroundTag":"duplicate-maven-module-gav","analyzedSha":"e4093d4e120eac99d6bdce5ba67cace2f3085c97","analyzedAt":"2026-08-21T22:58:24.034Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}