quarkusio/quarkus · error · RuntimeException

Failed to build model for ${groupId}:${artifactId}:${version

Error message

Failed to build model for ${groupId}:${artifactId}:${version}

What it means

MavenModelBuilder completes a workspace project model build and needs the active profiles from the Maven settings (ctx.getActiveSettingsProfiles()). If reading/activating those settings profiles fails, it throws a RuntimeException naming the groupId:artifactId:version of the raw model it was building. The real reason is in the wrapped BootstrapMavenException cause.

Source

Thrown at independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/MavenModelBuilder.java:118

    private void completeWorkspaceProjectBuildRequest(ModelBuildingRequest request) {
        final Set<String> addedProfiles;
        final List<Profile> profiles = request.getProfiles();
        if (profiles.isEmpty()) {
            addedProfiles = Set.of();
        } else {
            addedProfiles = new HashSet<>(profiles.size());
            for (Profile p : profiles) {
                addedProfiles.add(p.getId());
            }
        }

        final List<Profile> activeSettingsProfiles;
        try {
            activeSettingsProfiles = ctx.getActiveSettingsProfiles();
        } catch (BootstrapMavenException e) {
            var requestModel = request.getRawModel();
            throw new RuntimeException("Failed to build model for " + ModelUtils.getGroupId(requestModel)
                    + ":" + requestModel.getArtifactId() + ":" + ModelUtils.getVersion(requestModel), e);
        }

        for (Profile p : activeSettingsProfiles) {
            if (!addedProfiles.contains(p.getId())) {
                profiles.add(p);
                request.getActiveProfileIds().add(p.getId());
            }
        }

        final BootstrapMavenOptions cliOptions = ctx.getCliOptions();
        request.getActiveProfileIds().addAll(cliOptions.getActiveProfileIds());
        request.getInactiveProfileIds().addAll(cliOptions.getInactiveProfileIds());
        request.setUserProperties(System.getProperties());
    }

    @Override
    public ModelBuildingResult build(ModelBuildingRequest request, ModelBuildingResult result) throws ModelBuildingException {

View on GitHub (pinned to e1c734241f)

Solutions

  1. Validate ~/.m2/settings.xml (and -s/-gs alternates) parses as XML and follows the Maven settings schema
  2. Read the wrapped BootstrapMavenException cause for the exact settings/profile problem and fix that (bad profile id, missing file, invalid activation)
  3. Temporarily move settings.xml aside to confirm it is the trigger, then re-add profiles one by one
  4. Check the GAV printed in the message: confirm the pom's groupId/artifactId/version (or inherited parent version) is resolvable

Example fix

// before: broken settings.xml
<settings><profiles><profile><id>dev</id><repositories><repository><url>file:/missing/repo</url></repository></repositories></profile></profiles></settings>
// after: remove or fix the invalid profile entry, then validate with
mvn help:effective-settings
Defensive patterns

Strategy: validation

Validate before calling

// Validate settings.xml parses before building models
Path settings = Path.of(System.getProperty("user.home"), ".m2", "settings.xml");
if (Files.exists(settings)) {
    try (InputStream in = Files.newInputStream(settings)) {
        DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(in);
    } catch (Exception e) {
        throw new IllegalStateException("Invalid settings.xml: " + settings, e);
    }
}

Try / catch

try {
    Model model = modelBuilder.build(request);
} catch (RuntimeException e) {
    Throwable cause = e.getCause();
    log.error("Model build failed for project; root cause: " + (cause != null ? cause.getMessage() : e.getMessage()));
    throw e;
}

Prevention

When it happens

Trigger: Calling the model builder (via build()/completeWorkspaceProjectBuildRequest) for a project while the user's settings.xml cannot be read, is malformed XML, or profile activation in it throws - i.e. any BootstrapMavenException from ctx.getActiveSettingsProfiles().

Common situations: Invalid ~/.m2/settings.xml (syntax error, wrong namespace), a settings profile referencing a missing file or repo, stale settings after a Maven upgrade, a corrupted local settings cache, or a project version derived from an unresolvable parent.

Related errors


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