{"record":{"id":"da2da6f326c1e63f","repo":"quarkusio/quarkus","slug":"failed-to-resolve-maven-plugin-version-containing","errorCode":null,"errorMessage":"Failed to resolve maven plugin version containing <cls>","messagePattern":"Failed to resolve maven plugin version containing <cls>","errorType":"exception","errorClass":"MojoExecutionException","httpStatus":null,"severity":"error","filePath":"devtools/maven/src/main/java/io/quarkus/maven/CreateUtils.java","lineNumber":51,"sourceCode":"    }\n\n    public static String getDerivedPath(String className) {\n        String[] resourceClassName = StringUtils.splitByCharacterTypeCamelCase(\n                className.substring(className.lastIndexOf(\".\") + 1));\n        return \"/\" + resourceClassName[0].toLowerCase();\n    }\n\n    public static Plugin resolvePluginInfo(Class<?> cls) throws MojoExecutionException {\n        try {\n            final Path classOrigin = MojoUtils.getClassOrigin(cls);\n            if (Files.isDirectory(classOrigin)) {\n                return resolvePluginInfo(classOrigin.resolve(\"META-INF\").resolve(\"maven\").resolve(\"plugin.xml\"));\n            }\n            try (FileSystem fs = ZipUtils.newFileSystem(classOrigin)) {\n                return resolvePluginInfo(fs.getPath(\"META-INF\", \"maven\", \"plugin.xml\"));\n            }\n        } catch (Exception e) {\n            throw new MojoExecutionException(\"Failed to resolve maven plugin version containing \" + cls, e);\n        }\n    }\n\n    private static Plugin resolvePluginInfo(Path pluginXml) throws MojoExecutionException {\n        if (!Files.exists(pluginXml)) {\n            throw new MojoExecutionException(\"Failed to locate \" + pluginXml);\n        }\n        final DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();\n        try {\n            final DocumentBuilder db = dbf.newDocumentBuilder();\n            try (InputStream is = Files.newInputStream(pluginXml)) {\n                final Document doc = db.parse(is);\n                final Node pluginNode = getElement(doc.getChildNodes(), \"plugin\");\n                final Plugin plugin = new Plugin();\n                plugin.setGroupId(getChildElementTextValue(pluginNode, \"groupId\"));\n                plugin.setArtifactId(getChildElementTextValue(pluginNode, \"artifactId\"));\n                plugin.setVersion(getChildElementTextValue(pluginNode, \"version\"));\n                return plugin;","sourceCodeStart":33,"sourceCodeEnd":69,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/devtools/maven/src/main/java/io/quarkus/maven/CreateUtils.java#L33-L69","documentation":"CreateUtils.resolvePluginInfo locates the running Quarkus Maven plugin's own descriptor (META-INF/maven/plugin.xml) either next to the class (exploded dir) or inside its jar via ZipUtils.newFileSystem. Any exception while locating/opening the class origin or reading the descriptor is rethrown as this MojoExecutionException naming the class. It is used to discover the plugin version for invoking nested goals like create/add-extension in the generated project.","triggerScenarios":"Calling createUtils-based goal invocation where the JAR containing the plugin class cannot be opened as a zip (corrupted download), the class origin path cannot be determined, or an unexpected I/O error occurs accessing META-INF/maven/plugin.xml.","commonSituations":"Corrupted ~/.m2 repository entry for quarkus-maven-plugin (interrupted download); running plugin classes from an unusual classloader/custom setup where classOrigin resolution fails; mixed plugin versions on the classpath.","solutions":["Delete the quarkus-maven-plugin artifacts under ~/.m2/repository/io/quarkus/quarkus-maven-plugin and let Maven re-download them","Run with `mvn -U` to force re-resolution of plugin artifacts","Verify exactly one version of quarkus-maven-plugin is used (check pluginManagement/dependency convergence)","Inspect the 'Caused by' exception for the underlying zip/file-system error"],"exampleFix":"# corrupted local artifact\nrm -rf ~/.m2/repository/io/quarkus/quarkus-maven-plugin\nmvn -U io.quarkus:quarkus-maven-plugin:create","handlingStrategy":"try-catch","validationCode":"# Verify the plugin jar is a valid zip before running goals\nunzip -tq $(find ~/.m2/repository/io/quarkus/quarkus-maven-plugin -name '*.jar' | head -1) > /dev/null && echo OK","typeGuard":null,"tryCatchPattern":"try {\n    Plugin p = resolvePluginInfo(cls);\n} catch (MojoExecutionException e) {\n    // inspect cause: ZipException => corrupted jar; delete and re-resolve the artifact\n    logger.error(\"Plugin descriptor resolution failed: \" + e.getCause(), e);\n}","preventionTips":["Avoid interrupting Maven downloads; run -U after any interruption","Keep a single quarkus-maven-plugin version on the classpath","Do not unpack/modify plugin jars in ~/.m2","Check 'Caused by' for ZipException to distinguish corruption from path issues"],"tags":["maven","plugin-resolution","classpath"],"backgroundTag":"plugin-descriptor-not-found","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}