{"record":{"id":"6121aad0cf46ace2","repo":"apache/maven","slug":"the-project-exclusion-s-in-projects-pl-resulted","errorCode":null,"errorMessage":"The project exclusion%s in --projects/-pl resulted in an empty reactor, please correct %s.","messagePattern":"The project exclusion(.+?) in --projects/-pl resulted in an empty reactor, please correct (.+?)\\.","errorType":"exception","errorClass":"MavenExecutionException","httpStatus":null,"severity":"error","filePath":"impl/maven-core/src/main/java/org/apache/maven/graph/DefaultGraphBuilder.java","lineNumber":256,"sourceCode":"        Set<String> optionalSelectors = projectActivation.getOptionalInactiveProjectSelectors();\n        if (!requiredSelectors.isEmpty() || !optionalSelectors.isEmpty()) {\n            Set<MavenProject> excludedProjects = new HashSet<>(requiredSelectors.size() + optionalSelectors.size());\n            List<MavenProject> allProjects = graph.getAllProjects();\n            excludedProjects.addAll(\n                    projectSelector.getRequiredProjectsBySelectors(request, allProjects, requiredSelectors));\n            excludedProjects.addAll(\n                    projectSelector.getOptionalProjectsBySelectors(request, allProjects, optionalSelectors));\n\n            result = new ArrayList<>(projects);\n            result.removeAll(excludedProjects);\n\n            if (result.isEmpty()) {\n                boolean isPlural = excludedProjects.size() > 1;\n                String message = String.format(\n                        \"The project exclusion%s in --projects/-pl resulted in an \"\n                                + \"empty reactor, please correct %s.\",\n                        isPlural ? \"s\" : \"\", isPlural ? \"them\" : \"it\");\n                throw new MavenExecutionException(message, request.getPom());\n            }\n        }\n\n        return result;\n    }\n\n    private List<MavenProject> includeAlsoMakeTransitively(\n            List<MavenProject> projects, MavenExecutionRequest request, ProjectDependencyGraph graph)\n            throws MavenExecutionException {\n        List<MavenProject> result = projects;\n\n        String makeBehavior = request.getMakeBehavior();\n        boolean makeBoth = MavenExecutionRequest.REACTOR_MAKE_BOTH.equals(makeBehavior);\n\n        boolean makeUpstream = makeBoth || MavenExecutionRequest.REACTOR_MAKE_UPSTREAM.equals(makeBehavior);\n        boolean makeDownstream = makeBoth || MavenExecutionRequest.REACTOR_MAKE_DOWNSTREAM.equals(makeBehavior);\n\n        if ((makeBehavior != null && !makeBehavior.isEmpty()) && !makeUpstream && !makeDownstream) {","sourceCodeStart":238,"sourceCodeEnd":274,"githubUrl":"https://github.com/apache/maven/blob/e4093d4e120eac99d6bdce5ba67cace2f3085c97/impl/maven-core/src/main/java/org/apache/maven/graph/DefaultGraphBuilder.java#L238-L274","documentation":"MavenExecutionException thrown by the graph builder when project exclusions (--projects/-pl with '!' selectors) remove every project from the reactor, leaving nothing to build. It is computed after result.removeAll(excludedProjects) over the full module list; the message pluralizes ('exclusion(s)', 'correct it/them') based on how many selectors were excluded.","triggerScenarios":"mvn -pl '!module' (or mixed selection like -pl 'app,!app') where the exclusion set covers all reactor projects — e.g. a single-module reactor with -pl '!app', or excluding the root plus every module, or quoting mistakes that turn the entire selection into exclusions.","commonSituations":"Shell quoting errors where '!' expands or the whole argument becomes an exclusion; excluding the only module in a small reactor; combining -pl '!x' with -amd expecting projects that are not in the graph.","solutions":["Re-run keeping at least one module: mvn -pl 'app,!app-it' install","Quote the selectors so the shell does not interpret '!': mvn -pl \"!module-to-skip\"","Verify what the selectors match against the reactor module list (mvn help:evaluate -Dexpression=project.modules or the build summary) before excluding"],"exampleFix":"# before: exclusion leaves an empty reactor\nmvn -pl '!app' install\n\n# after: keep one module, exclude another\nmvn -pl 'app,!app-it' install","handlingStrategy":"validation","validationCode":"// With the reactor module list known, simulate the selection before invoking Maven\nList<String> modules = List.of(\"app\", \"app-it\", \"docs\"); // e.g. parsed from the root pom\nSet<String> selected = new HashSet<>(modules);\nselected.removeAll(Set.of(exclusions)); // exclusions from -pl '!x'\nif (selected.isEmpty()) {\n    throw new IllegalArgumentException(\"-pl exclusions remove every module; keep at least one\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Quote -pl arguments containing '!' in shells","Dry-run selections (mvn -pl ... validate) in CI scripts after module renames","Prefer ':artifactId' selectors over raw paths in automation"],"tags":["maven","reactor","projects-option","cli","project-selection"],"backgroundTag":"empty-reactor-selection","analyzedSha":"e4093d4e120eac99d6bdce5ba67cace2f3085c97","analyzedAt":"2026-08-21T22:58:24.034Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}