quarkusio/quarkus · error · MojoExecutionException
Failed to parse <pluginXml>
Error message
Failed to parse <pluginXml>
What it means
After confirming the plugin.xml file exists, resolvePluginInfo parses it with DocumentBuilder and extracts groupId/artifactId/version. Any Throwable during XML building/parsing or extraction is wrapped in this MojoExecutionException 'Failed to parse <pluginXml>'. It means the plugin descriptor exists but its content could not be read as a valid plugin.xml document.
Source
Thrown at devtools/maven/src/main/java/io/quarkus/maven/CreateUtils.java:72
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);
}
}
private static String getChildElementTextValue(final Node parentNode, String childName) throws MojoExecutionException {
final Node node = getElement(parentNode.getChildNodes(), childName);
final String text = getText(node);
if (text.isEmpty()) {
throw new MojoExecutionException(
"The " + parentNode.getNodeName() + " element description is missing child " + childName);
}
return text;
}
private static Node getElement(NodeList nodeList, String name) throws MojoExecutionException {
for (int i = 0; i < nodeList.getLength(); ++i) {
final Node item = nodeList.item(i);
if (item.getNodeType() == Node.ELEMENT_NODE
&& (name.equals(item.getNodeName()) || name.equals(item.getLocalName()))) {View on GitHub (pinned to e1c734241f)
Solutions
- Inspect the 'Caused by' (often SAXParseException) to see the exact XML defect
- Delete the cached quarkus-maven-plugin artifact from ~/.m2 and re-download with -U
- Validate plugin.xml content manually: `unzip -p <jar> META-INF/maven/plugin.xml | xmllint -`
- If you built the plugin locally, run a clean full build so the maven-plugin-plugin regenerates the descriptor
Example fix
# truncated/corrupted descriptor rm -rf ~/.m2/repository/io/quarkus/quarkus-maven-plugin mvn -U io.quarkus:quarkus-maven-plugin:create
Defensive patterns
Strategy: validation
Validate before calling
# Validate the descriptor parses before use unzip -p quarkus-maven-plugin-*.jar META-INF/maven/plugin.xml | xmllint --noout - && echo VALID
Try / catch
try {
Plugin p = resolvePluginInfo(pluginXml);
} catch (MojoExecutionException e) {
Throwable cause = e.getCause();
if (cause instanceof org.xml.sax.SAXParseException spe) {
logger.error("Malformed plugin.xml at line " + spe.getLineNumber() + ": " + spe.getMessage());
}
} Prevention
- Re-download artifacts after suspected truncated downloads (rm + mvn -U)
- Validate plugin.xml with xmllint when diagnosing packaging issues
- Run clean full builds of the plugin locally so maven-plugin-plugin regenerates the descriptor
- Treat the 'Caused by' SAXParseException as the real diagnostic
When it happens
Trigger: META-INF/maven/plugin.xml in the plugin jar is malformed/truncated (corrupted download), unreadable bytes, empty file, or the child-extraction helper throws (missing required elements leading to a thrown error in getChildElementTextValue/getText).
Common situations: Interrupted downloads leaving a truncated jar in ~/.m2; manually edited or regenerated plugin.xml; jar corruption on disk; packaging bugs where plugin.xml contains invalid XML.
Understand the failure class
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
Related errors
- Unable to parse pom file: ${pom}
- Failed to locate <pluginXml>
- The <parentNodeName> element description is missing child <c
- Failed to locate element <name>
- Failed to parse POM
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/5e214f553e5bb7e2.
Report an issue: GitHub.