quarkusio/quarkus · error · RuntimeException

Unable to determine groupId and artifactId of the extension

Error message

Unable to determine groupId and artifactId of the extension that contains ${clazz.getName()} because the directory doesn't contain the necessary metadata

What it means

Variant of the groupId/artifactId resolution for classes located in a target/classes directory (typical during workspace builds). ArtifactInfoUtil looks in the sibling maven-archiver directory for pom metadata; when the directory contains none, this RuntimeException is thrown naming the extension and class.

Source

Thrown at core/deployment/src/main/java/io/quarkus/deployment/util/ArtifactInfoUtil.java:105

                    }
                    return ret;
                }
            } else if ("file".equals(codeLocation.getProtocol())) {
                // E.g. /quarkus/extensions/arc/deployment/target/classes/io/quarkus/arc/deployment/devconsole
                // This can happen if you run an example app in dev mode
                // and this app is part of a multi-module project which also declares the extension
                // Just try to locate the pom.properties file in the target/maven-archiver directory
                // Note that this hack will not work if addMavenDescriptor=false or if the pomPropertiesFile is overridden
                Path location = Paths.get(codeLocation.toURI());
                while (!isTargetClasses(location) && location.getParent() != null) {
                    location = location.getParent();
                }
                if (isTargetClasses(location)) {
                    Path mavenArchiver = location.getParent().resolve("maven-archiver");
                    if (mavenArchiver.toFile().canRead()) {
                        Entry<String, String> ret = groupIdAndArtifactId(mavenArchiver);
                        if (ret == null) {
                            throw new RuntimeException(
                                    "Unable to determine groupId and artifactId of the extension that contains "
                                            + clazz.getName()
                                            + " because the directory doesn't contain the necessary metadata");
                        }
                        return ret;
                    }
                }
                return new AbstractMap.SimpleEntry<>("unspecified", "unspecified");
            } else {
                return new AbstractMap.SimpleEntry<>("unspecified", "unspecified");
            }
        } catch (IOException | URISyntaxException e) {
            throw new RuntimeException("Unable to determine groupId and artifactId of the jar that contains " + clazz.getName(),
                    e);
        }
    }

    /**

View on GitHub (pinned to e1c734241f)

Solutions

  1. Run 'mvn install' (or at least package) for the extension so target/maven-archiver with archive metadata exists
  2. Rebuild the affected extension module: ./mvnw install -f extensions/<name>/
  3. Do a clean rebuild if target is stale/partial: mvn clean install -f extensions/<name>/
  4. Guard the call with try-catch if coordinates are only informational

Example fix

// terminal, not code
# before (fails)
./mvnw test -f extensions/arc/runtime/
# after
./mvnw install -f extensions/arc/ && ./mvnw test -f extensions/arc/runtime/
Defensive patterns

Strategy: try-catch

Validate before calling

boolean targetClassesHaveArchiver(Class<?> clazz) throws Exception {
    var loc = clazz.getProtectionDomain().getCodeSource().getLocation();
    if (loc == null) return false;
    var p = java.nio.file.Paths.get(loc.toURI());
    return p.endsWith("target/classes") && p.getParent().resolve("maven-archiver").toFile().canRead();
}

Try / catch

try {
    var ga = ArtifactInfoUtil.groupIdAndArtifactId(clazz);
    use(ga.getKey(), ga.getValue());
} catch (RuntimeException e) {
    log.warnf("Workspace build metadata missing for %s; run mvn install", clazz.getName());
    use("unspecified", "unspecified");
}

Prevention

When it happens

Trigger: Resolving coordinates for a class loaded from an extension module's target/classes where the maven-archiver directory is missing or unreadable (mvn package not run, target partially cleaned, or build executed via an IDE that skips the archiver plugin).

Common situations: Quarkus development where extensions are built from source; running tests before 'mvn install' produced maven-archiver; cleaning target directories while a running process resolves coordinates; IDE-built classes directories.

Related errors


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