quarkusio/quarkus · error · IllegalArgumentException
Invalid dependency description '<dependency>'
Error message
Invalid dependency description '<dependency>'
What it means
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.
Source
Thrown at independent-projects/tools/devtools-common/src/main/java/io/quarkus/maven/utilities/MojoUtils.java:108
.anyMatch(d -> groupId.equals(d.getGroupId())
&& artifactId.equals(d.getArtifactId()));
}
public static Dependency parse(String dependency) {
Dependency res = new Dependency();
String[] segments = dependency.split(":");
if (segments.length >= 2) {
res.setGroupId(segments[0].toLowerCase());
res.setArtifactId(segments[1].toLowerCase());
if (segments.length >= 3 && !segments[2].isEmpty()) {
res.setVersion(segments[2]);
}
if (segments.length >= 4) {
res.setClassifier(segments[3].toLowerCase());
}
return res;
} else {
throw new IllegalArgumentException("Invalid dependency description '" + dependency + "'");
}
}
/**
* Builds the configuration for the goal using Elements
*
* @param elements A list of elements for the configuration section
* @return The elements transformed into the Maven-native XML format
*/
public static Xpp3Dom configuration(Element... elements) {
Xpp3Dom dom = new Xpp3Dom("configuration");
for (Element e : elements) {
dom.addChild(e.toDom());
}
return dom;
}
/**View on GitHub (pinned to e1c734241f)
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
Example fix
// before
MojoUtils.parseDependency("quarkus-jdbc-postgresql");
// after
MojoUtils.parseDependency("io.quarkus:quarkus-jdbc-postgresql:3.15.0"); Defensive patterns
Strategy: validation
Validate before calling
boolean ok = dep != null && dep.trim().split(":", -1).length >= 2 && !dep.trim().isEmpty();
if (!ok) throw new IllegalArgumentException("Dependency must be groupId:artifactId[:version[:classifier]]: " + dep); Type guard
static boolean isCoordinateFormat(String s) {
return s != null && s.matches("[^:]+:[^:]+(:[^:]+)?(:[^:]+)?");
} Try / catch
try {
Dependency d = MojoUtils.parseDependency(dep);
} catch (IllegalArgumentException e) {
log.error("Bad dependency format '{}': use groupId:artifactId:version", dep);
} Prevention
- 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
When it happens
Trigger: 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 ':'.
Common situations: 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).
Related errors
- Unable to determine groupId and artifactId of the jar that c
- Unable to determine groupId and artifactId of the extension
- Unable to determine groupId and artifactId of the jar that c
- Unable to parse pom file: ${pom}
- The specified %s identifier (%s) contains invalid characters
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/4a558a969d711527.
Report an issue: GitHub.