quarkusio/quarkus · error · IllegalArgumentException

${coords} is not a POM

Error message

${coords} is not a POM

What it means

MavenBuildFile.importBom only supports importing BOMs, i.e. artifacts whose packaging type is 'pom'. If the passed ArtifactCoords has any other type, it throws IllegalArgumentException naming the offending coordinates. This is an argument-validation guard against adding a non-BOM artifact as a bom import in pom.xml.

Source

Thrown at independent-projects/tools/devtools-common/src/main/java/io/quarkus/devtools/project/buildfile/MavenBuildFile.java:61

    public MavenBuildFile(final Path projectDirPath, ExtensionCatalog catalog) {
        super(projectDirPath, catalog);
    }

    @Override
    public void writeToDisk() throws IOException {
        if (getModel() == null) {
            return;
        }
        try (ByteArrayOutputStream pomOutputStream = new ByteArrayOutputStream()) {
            MojoUtils.write(getModel(), pomOutputStream);
            writeToProjectFile(BuildTool.MAVEN.getDependenciesFile(), pomOutputStream.toByteArray());
        }
    }

    @Override
    protected boolean importBom(ArtifactCoords coords) {
        if (!ArtifactCoords.TYPE_POM.equals(coords.getType())) {
            throw new IllegalArgumentException(coords + " is not a POM");
        }
        Model model = getModel();
        final Dependency d = new Dependency();
        d.setGroupId(coords.getGroupId());
        d.setArtifactId(coords.getArtifactId());
        d.setType(coords.getType());
        d.setScope(io.quarkus.maven.dependency.Dependency.SCOPE_IMPORT);
        DependencyManagement dependencyManagement = model.getDependencyManagement();
        if (dependencyManagement == null) {
            dependencyManagement = new DependencyManagement();
            model.setDependencyManagement(dependencyManagement);
        }
        if (dependencyManagement.getDependencies()
                .stream()
                .map(this::toResolvedDependency)
                .noneMatch(thisDep -> d.getManagementKey().equals(thisDep.getManagementKey()))) {
            dependencyManagement.addDependency(d);
            return true;

View on GitHub (pinned to e1c734241f)

Solutions

  1. Set the type on the coordinates to 'pom' before calling importBom (coords.withType(ArtifactCoords.TYPE_POM) or build with type="pom")
  2. If the goal is to add a regular dependency, use addDependency instead of importBom
  3. Verify the artifact string parsed into ArtifactCoords actually represents a BOM packaging

Example fix

// before
coords = ArtifactCoords.fromString("io.quarkus.platform:quarkus-bom:3.2.0.Final"); // type defaults to jar
buildFile.importBom(coords);
// after
coords = ArtifactCoords.fromString("io.quarkus.platform:quarkus-bom:pom:3.2.0.Final");
buildFile.importBom(coords);
Defensive patterns

Strategy: validation

Validate before calling

if (!ArtifactCoords.TYPE_POM.equals(coords.getType())) {
    throw new IllegalArgumentException("importBom requires type=pom, got: " + coords.getType());
}

Type guard

boolean isBomCoords(ArtifactCoords coords) {
    return coords != null && ArtifactCoords.TYPE_POM.equals(coords.getType());
}

Try / catch

try {
    buildFile.importBom(coords);
} catch (IllegalArgumentException e) {
    if (!e.getMessage().endsWith("is not a POM")) throw e;
    // convert coordinates to type 'pom' and retry, or use addDependency
}

Prevention

When it happens

Trigger: Calling MavenBuildFile.importBom(coords) with an ArtifactCoords whose getType() is 'jar' (the default) or anything other than 'pom', e.g. ArtifactCoords.of("io.quarkus","quarkus-bom",null,null,"jar").

Common situations: Constructing ArtifactCoords from a 'groupId:artifactId:version' string, which defaults type to 'jar', and passing it to importBom without overriding the type to 'pom'.

Related errors


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