quarkusio/quarkus · error · EnforcerRuleException

${missingDeploymentDeps.size()} minimal *-deployment depende

Error message

${missingDeploymentDeps.size()} minimal *-deployment dependencies are missing/configured incorrectly:
    ${joined}

To fix this issue, add the following dependencies to pom.xml:

        <!-- Minimal test dependencies to *-deployment artifacts for consistent build order -->
${requiredDeps}

What it means

This Maven enforcer rule (RequiresMinimalDeploymentDependency) verifies that every module which depends on a Quarkus extension runtime artifact also declares a test-scoped dependency on the corresponding *-deployment artifact, guaranteeing consistent build order. When runtime dependencies lack the matching minimal deployment dependency, execute() throws EnforcerRuleException listing each missing GAV and the exact <dependency> XML to paste.

Source

Thrown at independent-projects/enforcer-rules/src/main/java/io/quarkus/enforcer/RequiresMinimalDeploymentDependency.java:76

        List<String> missingDeploymentDeps = nonDeploymentArtifactsByGAV.entrySet().parallelStream()
                .filter(entry -> directDepsByGAV.containsKey(entry.getKey())) // only direct deps
                .map(entry -> parseDeploymentGAV(entry.getKey(), entry.getValue()))
                .sequential()
                .filter(optDeploymentGAV -> optDeploymentGAV
                        .map(deploymentGAV -> !isMinDeploymentDepPresent(deploymentGAV, projArtifactKey,
                                existingUnmatchedDeploymentDeps))
                        .orElse(false))
                .map(Optional::get)
                .sorted()
                .collect(Collectors.toList());

        if (!missingDeploymentDeps.isEmpty()) {
            String requiredDeps = missingDeploymentDeps.stream()
                    .map(gav -> (Object[]) gav.split(":"))
                    .map(gavArray -> String.format(DEP_TEMPLATE, gavArray))
                    .collect(Collectors.joining("\n"));
            throw new EnforcerRuleException(missingDeploymentDeps.size()
                    + " minimal *-deployment dependencies are missing/configured incorrectly:\n"
                    + "    " + missingDeploymentDeps.stream().collect(Collectors.joining("\n    "))
                    + "\n\nTo fix this issue, add the following dependencies to pom.xml:\n\n"
                    + "        <!-- Minimal test dependencies to *-deployment artifacts for consistent build order -->\n"
                    + requiredDeps);
        }
        if (!existingUnmatchedDeploymentDeps.isEmpty()) {
            Set<String> nonSuperfluous = parseNonSuperfluosArtifactIdsFromProperty(project);
            if (!nonSuperfluous.isEmpty()) {
                existingUnmatchedDeploymentDeps
                        .removeIf(gav -> nonSuperfluous.stream().anyMatch(aid -> gav.contains(":" + aid + ":")));
            }
            if (!existingUnmatchedDeploymentDeps.isEmpty()) {
                String superfluousDeps = existingUnmatchedDeploymentDeps.stream()
                        .map(gav -> "    " + gav)
                        .sorted()
                        .collect(Collectors.joining("\n"));
                throw new EnforcerRuleException(existingUnmatchedDeploymentDeps.size()

View on GitHub (pinned to e1c734241f)

Solutions

  1. Copy the <dependency> XML snippets printed in the error message into the <dependencies> section of your pom.xml
  2. Ensure each deployment dependency uses the exact scope/type/optional settings expected by the rule (typically test scope)
  3. Re-run the build to verify the enforcer rule passes

Example fix

<!-- before -->
<dependency>
  <groupId>io.quarkus</groupId>
  <artifactId>quarkus-myext</artifactId>
</dependency>
<!-- after -->
<dependency>
  <groupId>io.quarkus</groupId>
  <artifactId>quarkus-myext</artifactId>
</dependency>
<!-- Minimal test dependencies to *-deployment artifacts for consistent build order -->
<dependency>
  <groupId>io.quarkus</groupId>
  <artifactId>quarkus-myext-deployment</artifactId>
  <scope>test</scope>
  <type>pom</type>
  <optional>true</optional>
</dependency>
Defensive patterns

Strategy: validation

Validate before calling

// Check pom.xml pairs each runtime dep with a minimal test-scope -deployment dep before building
// mvn enforcer:enforce -Prules; or pre-validate:
Set<String> runtimeGavs = readDependencies(pom).stream()
    .filter(d -> d.getGroupId().startsWith("io.quarkus") && !d.getArtifactId().endsWith("-deployment"))
    .map(d -> d.getGroupId() + ":" + d.getArtifactId())
    .collect(toSet());
Set<String> depGavs = readDependencies(pom).stream().map(d -> d.getGroupId() + ":" + d.getArtifactId()).collect(toSet());
runtimeGavs.forEach(r -> assert depGavs.contains(r + "-deployment") : "missing minimal deployment dep: " + r);

Try / catch

// EnforcerRuleException fails the build by design; fix pom.xml rather than catching.
try {
  invoker.executeMaven("enforcer:enforce");
} catch (MavenInvocationException e) {
  if (e.getMessage().contains("minimal *-deployment dependencies are missing")) { fixPomDependencies(); }
  throw e;
}

Prevention

When it happens

Trigger: Running Maven with the enforcer rule enabled on a module whose pom.xml declares dependencies on io.quarkus.* runtime artifacts without matching minimal test dependencies on their *-deployment counterparts, or with the deployment dependency configured with wrong scope/type/optional flags.

Common situations: Adding a new Quarkus extension dependency to a pom.xml by hand; adding an internal extension runtime module and forgetting the deployment artifact; copying dependency blocks that omit the deployment test dep; renaming/refactoring modules so the deployment GAV no longer matches.

Related errors


AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05). Data as JSON: /api/errors/d8bc76f3421a993c. Report an issue: GitHub.