quarkusio/quarkus · error · AppModelResolverException

The application module hasn't been built yet

Error message

The application module hasn't been built yet

What it means

BootstrapAppModelResolver.resolveModel(WorkspaceModule) builds an application model using the module's compiled output. If the main sources exist but their output directory is not available (i.e. the project has never been compiled), the resolver throws this AppModelResolverException instead of proceeding with empty paths.

Source

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

            throws AppModelResolverException {
        return doResolveModel(appArtifact, toAetherDeps(directDeps),
                excludedArtifacts, managingProject,
                reloadableModules);
    }

    /**
     * Resolve application mode for the main application module that might not have a POM file on disk.
     *
     * @param module main application module
     * @return resolved application model
     * @throws AppModelResolverException in case application model could not be resolved
     */
    public ApplicationModel resolveModel(WorkspaceModule module)
            throws AppModelResolverException {
        final PathList.Builder resolvedPaths = PathList.builder();
        if (module.hasMainSources()) {
            if (!module.getMainSources().isOutputAvailable()) {
                throw new AppModelResolverException("The application module hasn't been built yet");
            }
            module.getMainSources().getSourceDirs().forEach(s -> {
                if (!resolvedPaths.contains(s.getOutputDir())) {
                    resolvedPaths.add(s.getOutputDir());
                }
            });
            module.getMainSources().getResourceDirs().forEach(s -> {
                if (!resolvedPaths.contains(s.getOutputDir())) {
                    resolvedPaths.add(s.getOutputDir());
                }
            });
        }
        final Artifact mainArtifact = new DefaultArtifact(module.getId().getGroupId(), module.getId().getArtifactId(), null,
                ArtifactCoords.TYPE_JAR,
                module.getId().getVersion());
        final ResolvedDependencyBuilder mainDep = ResolvedDependencyBuilder.newInstance()
                .setGroupId(mainArtifact.getGroupId())
                .setArtifactId(mainArtifact.getArtifactId())

View on GitHub (pinned to e1c734241f)

Solutions

  1. Compile the application module first, e.g. `mvn compile` (or the equivalent Gradle `compileJava`), then retry.
  2. If invoking programmatically, ensure the workspace module's sources output directory (target/classes) exists and contains classes before calling resolveModel.
  3. Check for build configuration issues (wrong outputDirectory, custom build dir) that make the resolver look at an empty/nonexistent output location.

Example fix

// before
resolver.resolveModel(appModule); // throws if target/classes missing
// after
new MavenProcessBuilder("mvn", "compile").run(); // build first
resolver.resolveModel(appModule);
Defensive patterns

Strategy: validation

Validate before calling

if (module.hasMainSources() && !module.getMainSources().isOutputAvailable()) {
    throw new IllegalStateException("Run 'mvn compile' before resolving model for " + module.getId());
}
resolver.resolveModel(module);

Type guard

static boolean isBuilt(io.quarkus.workspace.WorkspaceModule m) {
    return !m.hasMainSources() || m.getMainSources().isOutputAvailable();
}

Try / catch

try {
    model = resolver.resolveModel(module);
} catch (AppModelResolverException e) {
    if (e.getMessage().contains("hasn't been built yet")) {
        throw new IllegalStateException("Compile the project first: mvn compile", e);
    }
    throw e;
}

Prevention

When it happens

Trigger: Calling resolveModel(module) on a WorkspaceModule whose getMainSources().isOutputAvailable() returns false — i.e. the module has main sources declared but no compiled classes in target/classes (or equivalent output dir).

Common situations: Running a Quarkus dev-mode or tooling bootstrap against a freshly cloned project before `mvn compile`; cleaning the project and launching the app without recompiling; IDE-launched runs where incremental compilation has not produced output yet.

Related errors


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