quarkusio/quarkus · error · MojoExecutionException

Failed to build enhanced artifact

Error message

Failed to build enhanced artifact

What it means

BuildEnhancedArtifactMojo.doExecute wraps any Exception from the enhanced-artifact build pipeline (Quarkus bootstrap, augmentation, optional native/PGO steps) into this MojoExecutionException with the original cause. It marks the overall 'build enhanced artifact' goal as failed.

Source

Thrown at devtools/maven/src/main/java/io/quarkus/maven/BuildEnhancedArtifactMojo.java:121

        try {
            try (CuratedApplication curatedApplication = bootstrapApplication()) {
                AugmentAction action;
                if (enhancementType == EnhancementType.AOT_CONTAINER_IMAGE) {
                    action = curatedApplication.createAugmentor(
                            BuildAotEnhancedCustomizerProducer.class.getName(),
                            contextHolder.get());
                    action.performCustomBuild(BuildEnhancedAotContainerImageCommandHandler.class.getName(), null,
                            BuildAotOptimizedContainerImageResultBuildItem.class.getName());
                } else if (enhancementType == EnhancementType.PGO_NATIVE_IMAGE) {
                    action = curatedApplication.createAugmentor(
                            BuildPgoEnhancedCustomizerProducer.class.getName(),
                            contextHolder.get());
                    action.performCustomBuild(BuildPgoOptimizedNativeCommandHandler.class.getName(), null,
                            BuildPgoOptimizedNativeResultBuildItem.class.getName());
                }
            }
        } catch (Exception e) {
            throw new MojoExecutionException("Failed to build enhanced artifact", e);
        }
    }
}

View on GitHub (pinned to e1c734241f)

Solutions

  1. Inspect the 'Caused by' chain for the root build failure.
  2. Fix the underlying compilation/augmentation error reported in the log.
  3. For PGO/native steps, verify GraalVM native-image is installed and configured correctly.
Defensive patterns

Strategy: try-catch

Validate before calling

if (pgoEnabled && !nativeImageAvailable()) throw new IllegalStateException('native-image required for PGO build')

Try / catch

catch (MojoExecutionException e) { Throwable root = e; while (root.getCause() != null) root = root.getCause(); log.error('Enhanced artifact build root cause: ' + root.getMessage(), root); }

Prevention

When it happens

Trigger: Any exception during quarkus bootstrap, augmentation, jar/native build, or performCustomBuild for PGO-optimized native images inside doExecute's try block.

Common situations: Compilation or augmentation errors in application code; missing native-image toolchain when the PGO/native path runs; misconfigured application properties discovered during augmentation.

Related errors


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