{"record":{"id":"17b967f01708b4de","repo":"apache/maven","slug":"versionrange-cannot-be-empty","errorCode":null,"errorMessage":"versionRange cannot be empty","messagePattern":"versionRange cannot be empty","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"impl/maven-core/src/main/java/org/apache/maven/rtinfo/internal/DefaultRuntimeInformation.java","lineNumber":93,"sourceCode":"                logger.warn(msg, e);\n            } else {\n                logger.warn(msg);\n            }\n        }\n\n        String version = props.getProperty(\"version\", \"\").trim();\n\n        if (!version.startsWith(\"${\")) {\n            return version;\n        } else {\n            return \"\";\n        }\n    }\n\n    @Override\n    public boolean isMavenVersion(String versionRange) {\n        if (Objects.requireNonNull(versionRange, \"versionRange cannot be null\").isEmpty()) {\n            throw new IllegalArgumentException(\"versionRange cannot be empty\");\n        }\n\n        VersionConstraint constraint;\n        try {\n            constraint = versionScheme.parseVersionConstraint(versionRange);\n        } catch (InvalidVersionSpecificationException e) {\n            throw new IllegalArgumentException(e.getMessage(), e);\n        }\n\n        Version current;\n        try {\n            String mavenVersion = getMavenVersion();\n            if (mavenVersion.isEmpty()) {\n                throw new IllegalArgumentException(\"Could not determine current Maven version\");\n            }\n\n            current = versionScheme.parseVersion(mavenVersion);\n        } catch (InvalidVersionSpecificationException e) {","sourceCodeStart":75,"sourceCodeEnd":111,"githubUrl":"https://github.com/apache/maven/blob/e4093d4e120eac99d6bdce5ba67cace2f3085c97/impl/maven-core/src/main/java/org/apache/maven/rtinfo/internal/DefaultRuntimeInformation.java#L75-L111","documentation":"RuntimeInformation.isMavenVersion(String versionRange) compares the running Maven version against a Maven version constraint such as \"[3.0,)\" or a plain version. The argument is mandatory: null is rejected by Objects.requireNonNull and the empty string by this IllegalArgumentException, because an empty constraint is meaningless and almost always indicates an unset property.","triggerScenarios":"rtInfo.isMavenVersion(\"\") — most often a configurable value like ${maven.min.version} that resolved to empty because the property was never defined, or code that defaults missing config to the empty string.","commonSituations":"Prerequisite checks in mojos or extensions reading a version range from plugin configuration or a property that is absent; copy-pasted code where the range constant was deleted.","solutions":["Give the source property a concrete default, e.g. <properties><maven.min.version>[3.6.3,)</maven.min.version></properties>","Guard the call: skip the check or substitute a sane default when the configured value is blank","Pass a literal constraint such as \"[3.0,)\""],"exampleFix":"// before\nboolean ok = rtInfo.isMavenVersion(range); // range == \"\" when the property is unset\n\n// after\nString range = Optional.ofNullable(props.getProperty(\"maven.min.version\"))\n        .filter(s -> !s.isBlank())\n        .orElse(\"[3.6.3,)\");\nboolean ok = rtInfo.isMavenVersion(range);","handlingStrategy":"validation","validationCode":"if (range == null || range.isBlank()) {\n    range = \"[3.6.3,)\"; // or reject with a clear configuration error\n}\nboolean ok = rtInfo.isMavenVersion(range);","typeGuard":null,"tryCatchPattern":"try {\n    rtInfo.isMavenVersion(configuredRange);\n} catch (IllegalArgumentException e) {\n    throw new MojoExecutionException(\"version range misconfigured: '\" + configuredRange + \"'\", e);\n}","preventionTips":["Never feed unresolved ${...} properties straight into isMavenVersion; default them first","Treat a blank configured range as a configuration error and fail with a clear message"],"tags":["maven","version-range","validation","illegalargument"],"backgroundTag":"empty-required-argument","analyzedSha":"e4093d4e120eac99d6bdce5ba67cace2f3085c97","analyzedAt":"2026-08-21T22:58:24.034Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}