maven_version ';' MAVEN-VERSION
Builder
Summary
Convert a Maven-style version string to OSGi version format. Note: Use version_cleanup instead, which can be used in more contexts.
Syntax
${maven_version;<version>}
Parameters
- version: Maven version string to convert to OSGi format
Behavior
This macro is deprecated in favor of version_cleanup.
Converts Maven version formats (which may use hyphens) to OSGi version format (which uses dots):
- Replaces hyphens with dots in the qualifier
- Ensures the version follows OSGi’s
major.minor.micro.qualifierstructure
For example: 1.2.3-SNAPSHOT becomes 1.2.3.SNAPSHOT
Examples
# Convert Maven version
${maven_version;1.2.3-SNAPSHOT}
# Returns: 1.2.3.SNAPSHOT
# In Bundle-Version
Bundle-Version: ${maven_version;${project.version}}
# However, prefer version_cleanup:
Bundle-Version: ${version_cleanup;${project.version}}
Deprecation Note
This macro should not be used in new code. Use version_cleanup instead because:
version_cleanupcan be used in more contexts (not just Builder)version_cleanuphandles more edge cases and version formatsversion_cleanupis the recommended approach going forward
Related Macros
- version_cleanup - Preferred alternative with broader applicability
- versionmask - Transform versions using templates
- version - Alias for versionmask
See test cases in MacroTestsForDocsExamples.java
