quarkusio/quarkus · error · IOException

Failed to located META-INF/maven/<groupId>/<artifactId>/pom.

Error message

Failed to located META-INF/maven/<groupId>/<artifactId>/pom.xml in ${appJar}

What it means

ModelUtils.readAppModel(Path appJar) opens the JAR as a zip filesystem and scans META-INF/maven/<groupId>/<artifactId>/ for an embedded pom.xml. If the JAR has no such embedded POM descriptor, it throws IOException. Maven only embeds these descriptors for artifacts built with the default Maven lifecycle, so the JAR is not a (complete) Maven-built artifact.

Source

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

                    for (Path groupIdPath : groupIds) {
                        if (!Files.isDirectory(groupIdPath)) {
                            continue;
                        }
                        try (DirectoryStream<Path> artifactIds = Files.newDirectoryStream(groupIdPath)) {
                            for (Path artifactIdPath : artifactIds) {
                                if (!Files.isDirectory(artifactIdPath)) {
                                    continue;
                                }
                                final Path pomXml = artifactIdPath.resolve("pom.xml");
                                if (Files.exists(pomXml)) {
                                    return readModel(pomXml);
                                }
                            }
                        }
                    }
                }
            }
            throw new IOException("Failed to located META-INF/maven/<groupId>/<artifactId>/pom.xml in " + appJar);
        }
    }

    public static String getGroupId(Model model) {
        String groupId = model.getGroupId();
        if (groupId != null) {
            return groupId;
        }
        final Parent parent = model.getParent();
        if (parent != null) {
            groupId = parent.getGroupId();
            if (groupId != null) {
                return groupId;
            }
        }
        throw new IllegalStateException("Failed to determine groupId for project model");
    }

View on GitHub (pinned to e1c734241f)

Solutions

  1. Ensure the application JAR is built by Maven so META-INF/maven/<groupId>/<artifactId>/pom.xml is embedded (check the JAR: `unzip -l app.jar | grep META-INF/maven`).
  2. If the JAR was filtered/relocated, configure the build to keep META-INF/maven (e.g. shade plugin filter excludes that strip it).
  3. If the artifact is a plain third-party library, do not call readAppModel on it — resolve its model from the repository instead of the JAR.

Example fix

// before: reading a shaded jar
classifierJar = Path.of("target/app-1.0-shaded.jar");
Model m = ModelUtils.readAppModel(classifierJar); // IOException
// after: use the original (non-shaded) artifact built by Maven
classifierJar = Path.of("target/app-1.0.jar");
Model m = ModelUtils.readAppModel(classifierJar);
Defensive patterns

Strategy: try-catch

Validate before calling

static boolean hasEmbeddedPom(Path jar) throws IOException {
    try (FileSystem fs = ZipUtils.newFileSystem(jar)) {
        Path metaInfMaven = fs.getPath("META-INF", "maven");
        if (!Files.exists(metaInfMaven)) return false;
        try (var groups = Files.newDirectoryStream(metaInfMaven)) {
            for (Path g : groups) {
                try (var arts = Files.newDirectoryStream(g)) {
                    for (Path a : arts) {
                        if (Files.exists(a.resolve("pom.xml"))) return true;
                    }
                }
            }
        }
    }
    return false;
}

Type guard

static boolean isMavenBuiltJar(Path jar) throws IOException {
    try (var fs = ZipUtils.newFileSystem(jar)) {
        return Files.exists(fs.getPath("META-INF", "maven"));
    }
}

Try / catch

try {
    Model model = ModelUtils.readAppModel(appJar);
} catch (IOException e) {
    // jar lacks META-INF/maven/<g>/<a>/pom.xml; resolve model from repo instead
}

Prevention

When it happens

Trigger: Calling ModelUtils.readAppModel on a JAR that was not produced by `mvn package` (e.g. shaded/uber/relocated/obfuscated jars, jars built by Gradle or hand-assembled, or artifacts whose META-INF/maven directory was stripped), or where META-INF/maven exists but contains no <groupId>/<artifactId>/pom.xml entry.

Common situations: Provisioning or analyzing a third-party or dependency-relocated JAR with the Quarkus bootstrap; testing with an application JAR built outside Maven; a build pipeline that filters/rewrites META-INF; spring-boot style repackaged jars with different descriptor layout.

Related errors


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