java
build_error
ai_generated
true
Invalid version format: '1.0.0-SNAPSHOT ' (trailing whitespace) in dependency com.example:lib:1.0.0-SNAPSHOT
ID: java/maven-invalid-version-format
80%Fix Rate
85%Confidence
0Evidence
2024-12-01First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 8+ | active | — | — | — |
Root Cause
The version string contains leading or trailing whitespace, which is not allowed by Maven's version parser.
generic中文
版本字符串包含前导或尾部空格,Maven 版本解析器不允许。
Workarounds
-
100% success Trim whitespace from the version string in pom.xml
<version>1.0.0-SNAPSHOT</version> (no trailing spaces)
-
95% success Use a properties file to define the version without whitespace
<properties><lib.version>1.0.0-SNAPSHOT</lib.version></properties> and reference ${lib.version}
Dead Ends
Common approaches that don't work:
-
Using a different version without whitespace but not the intended one
80% fail
The dependency may not exist at that version, causing a resolution error.
-
Ignoring the error and hoping it works
99% fail
Maven will fail to parse the version and abort the build.