{"record":{"id":"e5b01d7de01e214d","repo":"quarkusio/quarkus","slug":"existingunmatcheddeploymentdeps-size-minimal","errorCode":null,"errorMessage":"${existingUnmatchedDeploymentDeps.size()} minimal *-deployment dependencies are superfluous and must be removed from pom.xml:\n${superfluousDeps}","messagePattern":"(.+?) minimal \\*-deployment dependencies are superfluous and must be removed from pom\\.xml:\n(.+?)","errorType":"validation","errorClass":"EnforcerRuleException","httpStatus":null,"severity":"error","filePath":"independent-projects/enforcer-rules/src/main/java/io/quarkus/enforcer/RequiresMinimalDeploymentDependency.java","lineNumber":94,"sourceCode":"            throw new EnforcerRuleException(missingDeploymentDeps.size()\n                    + \" minimal *-deployment dependencies are missing/configured incorrectly:\\n\"\n                    + \"    \" + missingDeploymentDeps.stream().collect(Collectors.joining(\"\\n    \"))\n                    + \"\\n\\nTo fix this issue, add the following dependencies to pom.xml:\\n\\n\"\n                    + \"        <!-- Minimal test dependencies to *-deployment artifacts for consistent build order -->\\n\"\n                    + requiredDeps);\n        }\n        if (!existingUnmatchedDeploymentDeps.isEmpty()) {\n            Set<String> nonSuperfluous = parseNonSuperfluosArtifactIdsFromProperty(project);\n            if (!nonSuperfluous.isEmpty()) {\n                existingUnmatchedDeploymentDeps\n                        .removeIf(gav -> nonSuperfluous.stream().anyMatch(aid -> gav.contains(\":\" + aid + \":\")));\n            }\n            if (!existingUnmatchedDeploymentDeps.isEmpty()) {\n                String superfluousDeps = existingUnmatchedDeploymentDeps.stream()\n                        .map(gav -> \"    \" + gav)\n                        .sorted()\n                        .collect(Collectors.joining(\"\\n\"));\n                throw new EnforcerRuleException(existingUnmatchedDeploymentDeps.size()\n                        + \" minimal *-deployment dependencies are superfluous and must be removed from pom.xml:\\n\"\n                        + superfluousDeps);\n            }\n        }\n    }\n\n    private boolean isMinDeploymentDepPresent(String deploymentGAV, String projArtifactKey,\n            Set<String> existingDeploymentDeps) {\n        return deploymentGAV.equals(projArtifactKey) // special case: current project itself is the \"required dependency\"\n                || existingDeploymentDeps.remove(deploymentGAV);\n    }\n\n    private Set<String> parseNonSuperfluosArtifactIdsFromProperty(MavenProject project) {\n        String propValue = project.getProperties().getProperty(\"enforcer.requiresMinimalDeploymentDependency.nonSuperfluous\");\n        if (propValue != null) {\n            return Arrays.stream(propValue.split(\",\")).map(String::trim).collect(Collectors.toSet());\n        } else {\n            return Collections.emptySet();","sourceCodeStart":76,"sourceCodeEnd":112,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/independent-projects/enforcer-rules/src/main/java/io/quarkus/enforcer/RequiresMinimalDeploymentDependency.java#L76-L112","documentation":"The RequiresMinimalDeploymentDependency enforcer rule also detects the opposite problem: pom.xml declares test dependencies on *-deployment artifacts that are not required by any runtime dependency. execute() throws EnforcerRuleException listing the superfluous GAVs that must be removed to keep dependency graphs minimal and build order consistent.","triggerScenarios":"Maven build with the enforcer rule active where existingUnmatchedDeploymentDeps is non-empty — i.e. a *-deployment artifact is declared in pom.xml but its corresponding runtime artifact is not a dependency (or was removed/renamed).","commonSituations":"Removing or renaming a runtime dependency but leaving its -deployment test dep behind; renaming an extension so GAVs no longer pair up; copy-pasting deployment dependencies that are unnecessary for the module.","solutions":["Remove the listed *-deployment dependency entries from pom.xml","If you intended to keep one, restore the matching runtime dependency so the pair is complete","Re-run the build to confirm the enforcer rule passes"],"exampleFix":"<!-- before -->\n<dependency>\n  <groupId>io.quarkus</groupId>\n  <artifactId>quarkus-oldext-deployment</artifactId>\n  <scope>test</scope>\n</dependency>\n<!-- after: remove the stale deployment dependency entirely -->","handlingStrategy":"validation","validationCode":"// Audit pom.xml for -deployment deps with no matching runtime dependency\nSet<String> gavs = readDependencies(pom).stream().map(d -> d.getGroupId() + \":\" + d.getArtifactId()).collect(toSet());\ngavs.stream().filter(g -> g.endsWith(\"-deployment\"))\n    .forEach(g -> { if (!gavs.contains(g.substring(0, g.length() - \"-deployment\".length())))\n      System.out.println(\"superfluous deployment dep: \" + g); });","typeGuard":null,"tryCatchPattern":"// Rule fails the build intentionally; react to the message instead:\ntry {\n  invoker.executeMaven(\"enforcer:enforce\");\n} catch (MavenInvocationException e) {\n  if (e.getMessage().contains(\"superfluous\")) { removeListedDeploymentDeps(); }\n  throw e;\n}","preventionTips":["When removing a runtime dependency, delete its -deployment test dependency in the same change","Never hand-add -deployment deps without a runtime counterpart","Run the enforcer rule locally before committing pom.xml changes","Search poms for \"-deployment\" periodically to audit pairing"],"tags":["maven","enforcer-rule","dependency-management","build-order"],"backgroundTag":"superfluous-maven-dependency","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-15T02:17:10.978Z"}