apache/maven · error · RuntimeException
Cannot convert string to integer: {value}
Error message
Cannot convert string to integer: {value} What it means
Error "Cannot convert string to integer: {value}" thrown in apache/maven.
Source
Thrown at impl/maven-impl/src/main/java/org/apache/maven/impl/model/profile/ConditionParser.java:645
* - a {@code Boolean}, returns {@code 1} for {@code true}, {@code 0} for {@code false}.
* If the object cannot be converted, a {@code RuntimeException} is thrown.
*
* @param value the object to convert to an integer
* @return the integer representation of the object
* @throws RuntimeException if the object cannot be converted to an integer
*/
public static int toInt(Object value) {
if (value instanceof Number number) {
return number.intValue(); // Converts number to int
} else if (value instanceof String string) {
try {
return Integer.parseInt(string); // Tries to parse string as int
} catch (NumberFormatException e) {
// If string is not an int, tries parsing as double and converting to int
try {
return (int) Double.parseDouble((String) value);
} catch (NumberFormatException e2) {
throw new RuntimeException("Cannot convert string to integer: " + value);
}
}
} else if (value instanceof Boolean bool) {
return bool ? 1 : 0; // True = 1, False = 0
} else {
throw new RuntimeException("Cannot convert to integer: " + value);
}
}
}
View on GitHub (pinned to e4093d4e12)
When it happens
Trigger: Thrown at impl/maven-impl/src/main/java/org/apache/maven/impl/model/profile/ConditionParser.java:645 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of apache/maven@e4093d4e12 (2026-08-21).
Data as JSON: /api/errors/63c5cb0abba83a10.
Report an issue: GitHub.