{"record":{"id":"4a558a969d711527","repo":"quarkusio/quarkus","slug":"invalid-dependency-description-dependency","errorCode":null,"errorMessage":"Invalid dependency description '<dependency>'","messagePattern":"Invalid dependency description '<dependency>'","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"independent-projects/tools/devtools-common/src/main/java/io/quarkus/maven/utilities/MojoUtils.java","lineNumber":108,"sourceCode":"                .anyMatch(d -> groupId.equals(d.getGroupId())\n                        && artifactId.equals(d.getArtifactId()));\n    }\n\n    public static Dependency parse(String dependency) {\n        Dependency res = new Dependency();\n        String[] segments = dependency.split(\":\");\n        if (segments.length >= 2) {\n            res.setGroupId(segments[0].toLowerCase());\n            res.setArtifactId(segments[1].toLowerCase());\n            if (segments.length >= 3 && !segments[2].isEmpty()) {\n                res.setVersion(segments[2]);\n            }\n            if (segments.length >= 4) {\n                res.setClassifier(segments[3].toLowerCase());\n            }\n            return res;\n        } else {\n            throw new IllegalArgumentException(\"Invalid dependency description '\" + dependency + \"'\");\n        }\n    }\n\n    /**\n     * Builds the configuration for the goal using Elements\n     *\n     * @param elements A list of elements for the configuration section\n     * @return The elements transformed into the Maven-native XML format\n     */\n    public static Xpp3Dom configuration(Element... elements) {\n        Xpp3Dom dom = new Xpp3Dom(\"configuration\");\n        for (Element e : elements) {\n            dom.addChild(e.toDom());\n        }\n        return dom;\n    }\n\n    /**","sourceCodeStart":90,"sourceCodeEnd":126,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/independent-projects/tools/devtools-common/src/main/java/io/quarkus/maven/utilities/MojoUtils.java#L90-L126","documentation":"MojoUtils.parseDependency throws IllegalArgumentException when a dependency string cannot be split into the expected groupId:artifactId[:version[:classifier]] segments. The library requires at least 2 colon-separated segments to build a Maven Dependency object.","triggerScenarios":"Calling MojoUtils.parseDependency (or install/extension goals that parse dependency parameters) with a string like 'foo' or an empty/null-ish string that yields fewer than 4... fewer than 2 segments after splitting on ':'.","commonSituations":"Passing a bare artifact name without groupId on the CLI (quarkus:add-extension -Dextensions='myext' style mistakes), typos with missing colon, extra whitespace, or copied Maven coordinates in a non-colon format (gradle notation 'group:name:version' works, but 'name - version' does not).","solutions":["Use full coordinates 'groupId:artifactId:version[:classifier]' with at least groupId:artifactId","Check for typos such as a missing or doubled colon","If only the extension name is known, use the Quarkus extension catalog format (artifactId only is allowed by add-extension, but not by parseDependency)","Trim whitespace and stray quotes from the dependency string"],"exampleFix":"// before\nMojoUtils.parseDependency(\"quarkus-jdbc-postgresql\");\n// after\nMojoUtils.parseDependency(\"io.quarkus:quarkus-jdbc-postgresql:3.15.0\");","handlingStrategy":"validation","validationCode":"boolean ok = dep != null && dep.trim().split(\":\", -1).length >= 2 && !dep.trim().isEmpty();\nif (!ok) throw new IllegalArgumentException(\"Dependency must be groupId:artifactId[:version[:classifier]]: \" + dep);","typeGuard":"static boolean isCoordinateFormat(String s) {\n    return s != null && s.matches(\"[^:]+:[^:]+(:[^:]+)?(:[^:]+)?\");\n}","tryCatchPattern":"try {\n    Dependency d = MojoUtils.parseDependency(dep);\n} catch (IllegalArgumentException e) {\n    log.error(\"Bad dependency format '{}': use groupId:artifactId:version\", dep);\n}","preventionTips":["Always pass full Maven coordinates groupId:artifactId:version","Trim user input before parsing","Validate format with a regex before calling parseDependency","When accepting extension names from users, use the add-extension name-catalog path instead of raw coordinates"],"tags":["maven","argument-parsing","dependency"],"backgroundTag":"invalid-dependency-notation","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}