quarkusio/quarkus · error · RuntimeException
An error occurred attempting to resolve effective POM
Error message
An error occurred attempting to resolve effective POM
What it means
LocalRepositoryEffectiveModelResolver builds the effective POM of an artifact already stored in the local repository using Maven's DefaultModelBuilder. If the model builder fails (ModelBuildingException) — e.g. the POM is malformed, its parent cannot be resolved from the local repo, or required properties are missing — it wraps the cause in a RuntimeException with this message.
Source
Thrown at independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/LocalRepositoryEffectiveModelResolver.java:47
@Override
public Model resolveEffectiveModel(ArtifactCoords coords, List<RemoteRepository> repos) {
File pom = modelResolver.resolvePom(coords.getGroupId(), coords.getArtifactId(), coords.getVersion());
if (pom == null) {
return null;
}
ModelBuildingRequest req = new DefaultModelBuildingRequest();
req.setModelResolver(modelResolver);
req.setPomFile(pom);
req.getSystemProperties().putAll(System.getProperties());
req.setValidationLevel(ModelBuildingRequest.VALIDATION_LEVEL_MINIMAL);
// execute the model building request
DefaultModelBuilderFactory factory = new DefaultModelBuilderFactory();
DefaultModelBuilder builder = factory.newInstance();
try {
return builder.build(req).getEffectiveModel();
} catch (ModelBuildingException e) {
throw new RuntimeException("An error occurred attempting to resolve effective POM", e);
}
}
}
View on GitHub (pinned to e1c734241f)
Solutions
- Inspect the wrapped cause (getCause()) — it names the exact model building problem and location
- Delete the artifact's directory in ~/.m2/repository and re-download the POM to fix corruption
- Ensure the parent POM of the artifact exists in the local repository
- Validate the POM XML manually (mvn help:effective-pom) to spot syntax/schema issues
Example fix
// before: swallowing RuntimeException without cause
// after
catch (RuntimeException e) {
log.error("Effective POM failed", e.getCause()); // ModelBuildingException has line/column detail
} Defensive patterns
Strategy: try-catch
Validate before calling
if (!java.nio.file.Files.isRegularFile(pomPath)) throw new IllegalStateException("POM missing: " + pomPath);
// optionally sanity-check XML: DocumentBuilder.parse(pomPath) Type guard
boolean isBuildablePom(Path pom) throws IOException {
if (!Files.isRegularFile(pom)) return false;
try (var in = Files.newInputStream(pom)) {
DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(in);
return true;
} catch (Exception e) { return false; }
} Try / catch
try {
Model model = resolver.resolveEffectiveModel(gav);
} catch (RuntimeException e) {
Throwable cause = e.getCause(); // ModelBuildingException carries problem line/column
log.error("Effective POM build failed for " + gav + ": " + (cause != null ? cause.getMessage() : e));
} Prevention
- Keep the local repository clean; delete partially downloaded artifact dirs
- Always resolve parent POMs before building effective models from local repo
- Run mvn help:effective-pom as a pre-flight check on suspect POMs
- Pin a Maven model-builder version compatible with the POM's modelVersion
When it happens
Trigger: Calling resolveEffectiveModel(GAV) on a POM whose effective model cannot be built: invalid XML, unresolvable parent POM in the local repo, incompatible model version, or profile/property interpolation errors.
Common situations: Corrupt or truncated POM files in ~/.m2/repository from interrupted downloads; a parent POM that was never downloaded (see 'Has not been previously resolved' as a related root cause); POMs using features unsupported by the bundled Maven model builder version.
Related errors
- Has not been previously resolved
- Unable to determine groupId and artifactId of the jar that c
- Unable to determine groupId and artifactId of the extension
- Unable to determine groupId and artifactId of the jar that c
- Unable to parse pom file: ${pom}
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/55ded5d278a5e397.
Report an issue: GitHub.