quarkusio/quarkus · error · UnresolvableModelException

Has not been previously resolved

Error message

Has not been previously resolved

What it means

LocalRepoModelResolver is a Maven ModelResolver used during POM model building that can only resolve POMs already present in the local repository (or via its configured LocalPomResolvers); it never downloads from remote repositories. When asked for a GAV that has not been previously resolved into the local repo, it throws this UnresolvableModelException with the literal message 'Has not been previously resolved'. This is intentional: it is used for offline-style model building where only previously cached POMs are expected.

Source

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

        this.pomResolvers = pomResolvers;
    }

    @Override
    public File resolvePom(String groupId, String artifactId, String version) {
        for (LocalPomResolver pomResolver : pomResolvers) {
            var pom = pomResolver.resolvePom(groupId, artifactId, version);
            if (pom != null) {
                return pom;
            }
        }
        return null;
    }

    @Override
    public ModelSource resolveModel(String groupId, String artifactId, String version) throws UnresolvableModelException {
        var pomXml = resolvePom(groupId, artifactId, version);
        if (pomXml == null) {
            throw new UnresolvableModelException("Has not been previously resolved", groupId, artifactId, version);
        }
        return new ModelSource2() {
            @Override
            public InputStream getInputStream() throws IOException {
                return new FileInputStream(pomXml);
            }

            @Override
            public String getLocation() {
                return pomXml.getAbsolutePath();
            }

            @Override
            public ModelSource2 getRelatedSource(String relPath) {
                return null;
            }

            @Override

View on GitHub (pinned to e1c734241f)

Solutions

  1. Pre-populate the local repository by running a normal (online) Maven resolution of the project (mvn dependency:go-offline or a prior Quarkus resolve) so the POM is cached
  2. Check that groupId:artifactId:version in the failing parent/dependency reference is correct and exists
  3. Disable offline mode / remove local-repo-only configuration so a remote-capable resolver is used
  4. Clear corrupt local repo entries for the artifact (delete its directory in ~/.m2/repository) and re-resolve

Example fix

// before (offline resolve with empty ~/.m2)
new ApplicationModelBuilder().setOffline(true).resolve();
// after
mvn dependency:go-offline  // then run offline resolve
Defensive patterns

Strategy: try-catch

Validate before calling

File pom = new File(localRepo, g/artifactId + "/" + version + "/" + artifactId + "-" + version + ".pom");
if (!pom.isFile()) { /* resolve online first or fail fast */ }

Type guard

boolean isCached(GAV gav) {
    return java.nio.file.Files.isRegularFile(java.nio.file.Path.of(
        System.getProperty("user.home"), ".m2", "repository",
        gav.groupId().replace('.', '/'), gav.artifactId(), gav.version(),
        gav.artifactId() + "-" + gav.version() + ".pom"));
}

Try / catch

try {
    ModelSource src = resolver.resolveModel(g, a, v);
} catch (UnresolvableModelException e) {
    // fall back to full MavenArtifactResolver (online) or report missing GAV e.getGroupId()/getArtifactId()/getVersion()
}

Prevention

When it happens

Trigger: Calling MavenModelBuilder/resolveModel flows that build a POM whose parent or dependency POM is not present in ~/.m2/repository; using the resolver while offline or with local-repo-only mode before the artifact has ever been downloaded; referencing a parent/dependency version that does not exist in the local repository.

Common situations: Fresh CI machines or Docker images with an empty local repo; running with -o (offline) or quarkus bootstrap offline resolvers; typos in groupId/artifactId/version of a parent; a dependency that was declared but never downloaded (e.g. dependency resolution skipped).

Related errors


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