quarkusio/quarkus · error · BootstrapMavenException

Failed to locate in the workspace

Error message

Failed to locate  in the workspace

What it means

WorkspaceLoader builds an in-repository workspace of Maven modules and must return the LocalProject for the current project's POM. This error is thrown when, after loading all discovered workspace modules, the requested currentProjectPom is not among the known loaded modules. It indicates the target POM sits outside every module the workspace loader accepted or discovered.

Source

Thrown at independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/workspace/WorkspaceLoader.java:155

                while (!loadQueue.isEmpty()) {
                    final WorkspaceModulePom module = loadQueue.removeLast();
                    taskRunner.run(() -> loadModule(module));
                }
                taskRunner.waitForCompletion();
            }
            for (var module : knownModules.values()) {
                if (module.isLoaded()) {
                    module.process(loadedModelProcessor);
                }
            }
        }

        if (currentProject == null) {
            log.errorf("Failed to locate %s among the following loaded modules:", currentProjectPom);
            for (Path moduleDir : knownModules.keySet()) {
                log.error("- " + moduleDir);
            }
            throw new BootstrapMavenException("Failed to locate " + currentProjectPom + " in the workspace");
        }
        return currentProject;
    }

    private Consumer<WorkspaceModulePom> getLoadedModelProcessor(BootstrapMavenContext ctx) throws BootstrapMavenException {
        if (ctx == null || !ctx.isEffectiveModelBuilder()) {
            return this::processLoadedRawModel;
        }

        final ModelBuilder modelBuilder = BootstrapModelBuilderFactory.getDefaultModelBuilder();
        final BootstrapModelResolver modelResolver = BootstrapModelResolver.newInstance(ctx, this);
        final ModelCache modelCache = new BootstrapModelCache(modelResolver.getSession());
        final List<Profile> profiles = ctx.getActiveSettingsProfiles();
        final BootstrapMavenOptions cliOptions = ctx.getCliOptions();
        final List<String> activeProfileIds = new ArrayList<>(profiles.size() + cliOptions.getActiveProfileIds().size());
        for (Profile p : profiles) {
            activeProfileIds.add(p.getId());
        }

View on GitHub (pinned to e1c734241f)

Solutions

  1. Add the project (or the directory passed to load) to the parent aggregator POM's <modules> list so the loader discovers it
  2. Run the command from the workspace/aggregator root or pass the correct POM path
  3. Check the log output 'Failed to resolve effective model for ...' — fix the failing sibling module POM or set warnOnFailingWsModules=false to surface the real error
  4. Verify the path passed to loadWorkspace points to an existing pom.xml inside the workspace

Example fix

<!-- before: parent pom.xml -->
<modules>
  <module>app-a</module>
</modules>
<!-- after -->
<modules>
  <module>app-a</module>
  <module>app-b</module>
</modules>
Defensive patterns

Strategy: validation

Validate before calling

Path pom = Path.of("path/to/pom.xml");
if (!Files.isRegularFile(pom)) throw new IllegalStateException("POM not found: " + pom);
String parentDir = pom.getParent().toString();
// confirm the pom is reachable from the aggregator
if (!pom.toAbsolutePath().startsWith(workspaceRoot.toAbsolutePath()))
    throw new IllegalStateException("POM is outside the workspace root");

Try / catch

try {
    LocalProject p = workspaceLoader.load(ctx);
} catch (BootstrapMavenException e) {
    log.error("Project not in workspace; check parent <modules>: " + e.getMessage());
}

Prevention

When it happens

Trigger: Calling WorkspaceLoader.load (via loadWorkspace) with a POM path that is not a registered module of the discovered workspace: e.g. the path is outside the workspace root, the module was skipped due to a failed effective-model resolution with warnOnFailingWsModules=true, or the module is not referenced by any parent <modules> section.

Common situations: Running Quarkus dev/build from a subdirectory whose POM is not in the parent aggregator's module list; a parent POM missing a <module> entry for the project; a sibling module whose POM fails to load and is silently skipped as a warning; symlinks or case-mismatched paths preventing module-dir matching.

Related errors


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