quarkusio/quarkus · error · MojoExecutionException

Failed to locate <pluginXml>

Error message

Failed to locate <pluginXml>

What it means

The private resolvePluginInfo(Path pluginXml) overload checks Files.exists(pluginXml) first and throws this MojoExecutionException when the plugin descriptor file is absent. This happens when META-INF/maven/plugin.xml was not packaged with the plugin artifact or the wrong path/jar was probed, so the plugin's coordinates/version cannot be read.

Source

Thrown at devtools/maven/src/main/java/io/quarkus/maven/CreateUtils.java:57

    }

    public static Plugin resolvePluginInfo(Class<?> cls) throws MojoExecutionException {
        try {
            final Path classOrigin = MojoUtils.getClassOrigin(cls);
            if (Files.isDirectory(classOrigin)) {
                return resolvePluginInfo(classOrigin.resolve("META-INF").resolve("maven").resolve("plugin.xml"));
            }
            try (FileSystem fs = ZipUtils.newFileSystem(classOrigin)) {
                return resolvePluginInfo(fs.getPath("META-INF", "maven", "plugin.xml"));
            }
        } catch (Exception e) {
            throw new MojoExecutionException("Failed to resolve maven plugin version containing " + cls, e);
        }
    }

    private static Plugin resolvePluginInfo(Path pluginXml) throws MojoExecutionException {
        if (!Files.exists(pluginXml)) {
            throw new MojoExecutionException("Failed to locate " + pluginXml);
        }
        final DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
        try {
            final DocumentBuilder db = dbf.newDocumentBuilder();
            try (InputStream is = Files.newInputStream(pluginXml)) {
                final Document doc = db.parse(is);
                final Node pluginNode = getElement(doc.getChildNodes(), "plugin");
                final Plugin plugin = new Plugin();
                plugin.setGroupId(getChildElementTextValue(pluginNode, "groupId"));
                plugin.setArtifactId(getChildElementTextValue(pluginNode, "artifactId"));
                plugin.setVersion(getChildElementTextValue(pluginNode, "version"));
                return plugin;
            }
        } catch (Throwable t) {
            throw new MojoExecutionException("Failed to parse " + pluginXml, t);
        }
    }

View on GitHub (pinned to e1c734241f)

Solutions

  1. Reinstall/re-download the quarkus-maven-plugin artifact: delete it from ~/.m2 and run with -U
  2. Verify the jar actually contains META-INF/maven/plugin.xml: `unzip -l ~/.m2/repository/io/quarkus/.../quarkus-maven-plugin-*.jar | grep plugin.xml`
  3. Stop excluding META-INF/** in any shading/assembly configuration applied to the plugin jar
  4. Use the official plugin artifact via the quarkus.platform pom's pluginManagement instead of a locally built variant

Example fix

# verify the descriptor is present
unzip -l quarkus-maven-plugin-x.y.z.jar | grep META-INF/maven/plugin.xml
# if missing, restore the official artifact
rm -rf ~/.m2/repository/io/quarkus/quarkus-maven-plugin && mvn -U ...
Defensive patterns

Strategy: validation

Validate before calling

# Confirm the descriptor exists in the jar before invoking
unzip -l quarkus-maven-plugin-*.jar | grep 'META-INF/maven/plugin.xml'

Try / catch

// Caller-side: verify packaged resources before relying on the descriptor
if (!Files.exists(jarPath)) throw new IllegalStateException("Plugin jar missing: " + jarPath);
try (var fs = java.nio.file.FileSystems.newFileSystem(jarPath)) {
    if (java.nio.file.Files.notExists(fs.getPath("META-INF", "maven", "plugin.xml"))) {
        throw new IllegalStateException("plugin.xml not packaged in " + jarPath);
    }
}

Prevention

When it happens

Trigger: resolvePluginInfo(cls) finds a class origin (directory or jar) that does not contain META-INF/maven/plugin.xml — e.g. running from an unpacked/modified plugin directory, a shaded jar that dropped the descriptor, or a jar missing the packaged plugin.xml.

Common situations: Manually unpacked plugin jar for debugging; a custom/snapshot build of quarkus-maven-plugin without packaging the descriptor; shade/assembly config excluding META-INF resources; pointing the build at the wrong artifact.

Related errors


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