{"record":{"id":"40da5f44b4397155","repo":"quarkusio/quarkus","slug":"illegalruntimegavs-size-illegal-runtime-depen","errorCode":null,"errorMessage":"${illegalRuntimeGAVs.size()} illegal runtime dependencies found that have to be replaced with their -deployment counterparts:\n\t${joined}","messagePattern":"(.+?) illegal runtime dependencies found that have to be replaced with their -deployment counterparts:\n\t(.+?)","errorType":"validation","errorClass":"EnforcerRuleException","httpStatus":null,"severity":"error","filePath":"independent-projects/enforcer-rules/src/main/java/io/quarkus/enforcer/BansRuntimeDependency.java","lineNumber":35,"sourceCode":"@Named(\"bansRuntimeDependency\")\npublic class BansRuntimeDependency extends DeploymentDependencyRuleSupport {\n\n    @Override\n    protected void execute(MavenProject project, Map<String, Artifact> nonDeploymentArtifactsByGAV,\n            Map<String, Dependency> directDepsByGAV)\n            throws EnforcerRuleException {\n\n        String runtimeArtifactId = project.getArtifactId().replace(DEPLOYMENT_ARTIFACT_ID_SUFFIX, \"\");\n        List<String> illegalRuntimeGAVs = nonDeploymentArtifactsByGAV.entrySet().parallelStream()\n                .filter(entry -> directDepsByGAV.containsKey(entry.getKey())) // only direct deps\n                .filter(entry -> !entry.getValue().getArtifactId().equals(runtimeArtifactId)) // \"own\" runtime dep is alowed\n                .filter(entry -> parseDeploymentGAV(entry.getKey(), entry.getValue()).isPresent())\n                .map(entry -> entry.getValue().getArtifactId())\n                .sorted()\n                .collect(Collectors.toList());\n\n        if (!illegalRuntimeGAVs.isEmpty()) {\n            throw new EnforcerRuleException(illegalRuntimeGAVs.size()\n                    + \" illegal runtime dependencies found that have to be replaced with their \"\n                    + DEPLOYMENT_ARTIFACT_ID_SUFFIX + \" counterparts:\\n\\t\"\n                    + illegalRuntimeGAVs.stream().collect(Collectors.joining(\"\\n\\t\")));\n        }\n    }\n\n    @Override\n    protected boolean isCheckRequired(MavenProject project) {\n        return project.getArtifactId().endsWith(DEPLOYMENT_ARTIFACT_ID_SUFFIX);\n    }\n}\n","sourceCodeStart":17,"sourceCodeEnd":47,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/independent-projects/enforcer-rules/src/main/java/io/quarkus/enforcer/BansRuntimeDependency.java#L17-L47","documentation":"The BansRuntimeDependency enforcer rule scans a Maven module's runtime dependencies and rejects any Quarkus runtime artifact (quarkus-<ext>) that has a corresponding -deployment artifact, because Quarkus convention requires build-time code to depend on the -deployment artifact instead. When at least one such illegal dependency is found it throws EnforcerRuleException listing all offending artifactIds.","triggerScenarios":"Running mvn enforcer:enforce (via mvn verify on Quarkus modules) while a module's <dependencies> contains a quarkus-<name> runtime artifact that has a quarkus-<name>-deployment counterpart in the same reactor/dependency set and is not explicitly excluded from the check.","commonSituations":"Adding a new Quarkus extension dependency to a core/deployment module and forgetting the sibling -deployment dependency; copy-pasting runtime GAVs into deployment poms; renaming an extension so the rule now matches it.","solutions":["Add the matching -deployment dependency (quarkus-<name>-deployment) and remove/replace the runtime quarkus-<name> dependency where the rule requires it","If the runtime dependency is legitimately needed alongside, check the rule's exclusion configuration for allowed GAVs","Run mvn -pl <module> enforcer:enforce locally to iterate quickly until the list is empty"],"exampleFix":"<!-- before -->\n<dependency><groupId>io.quarkus</groupId><artifactId>quarkus-arc</artifactId></dependency>\n<!-- after (in a deployment module) -->\n<dependency><groupId>io.quarkus</groupId><artifactId>quarkus-arc-deployment</artifactId></dependency>","handlingStrategy":"validation","validationCode":"// Shell: preview offending runtime GAVs before the build\nmvn dependency:list -DincludeGroupIds=io.quarkus | grep -E 'quarkus-[a-z0-9-]+:jar' \\\n  | sed 's/.*quarkus-/quarkus-/' | sort","typeGuard":null,"tryCatchPattern":"// EnforcerRuleException aborts the Maven build; handle at build level\ntry {\n    mvn verify\n} catch (BuildFailure e) {\n    // parse the listed artifactIds, convert each runtime dep to -deployment\n}","preventionTips":["In Quarkus deployment modules, always depend on *-deployment artifacts, never plain runtime ones","Use the Quarkus parent pom / archetypes which pre-wire the correct dependency pattern","Run mvn enforcer:enforce locally before pushing","When adding an extension dependency, copy from an existing extension pom of the same kind"],"tags":["maven","enforcer","dependencies","quarkus-build"],"backgroundTag":"illegal-runtime-dependency","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}