• Intro Headers Instructions Macros Commands
Fork me on GitHub
    • Getting Started
      • Introduction
      • How to install bnd
      • Guided Tour Workspace & Projects
      • bnd / bndlib Features and JAR Wrapping Techniques
      • FAQ - Frequently Asked Questions
    • Concepts and Practices
      • Concepts
      • Background
      • Best practices
    • Build and Development
      • Build
      • Generating JARs
      • Versioning
      • Baselining
      • Service Components
      • Metatype
      • Contracts
      • Bundle Annotations
      • Accessor Properties
      • SPI Annotations
    • Dependency and Launching
      • Resolving Dependencies
      • Launching
      • Startlevels
    • Testing
      • Testing
      • Testing with Launchpad
    • Packaging and Distribution
      • Packaging Applications
      • JPMS Libraries
      • Wrapping Libraries to OSGi Bundles
    • Documentation and Tools
      • Generating Documentation
      • bnd CLI Commands
      • For Developers
      • Templates for Workspaces
      • Tips for Windows users
      • Tools bound to bnd
    • Reference Material
      • Reference
      • Headers
      • Instruction Reference
      • Instruction Index
      • Macro Reference
      • Macro Index
      • Plugins
      • External Plugins
    • Configuration and Troubleshooting
      • Settings
      • Errors
      • Warnings
  • maven_version ';' MAVEN-VERSION

    Prev Next
    Builder
    Cleanup a potential maven version to make it match an OSGi Version syntax.

    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.qualifier structure

    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_cleanup can be used in more contexts (not just Builder)
    • version_cleanup handles more edge cases and version formats
    • version_cleanup is 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

Prev Next
Search
    • Home