• 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
  • sort (';' LIST )+

    Prev Next
    Macro
    Sort lists alphabetically

    Summary

    The sort macro combines one or more lists and sorts their contents alphabetically (lexicographically). The sorting is case-sensitive with uppercase letters before lowercase.

    Syntax

    ${sort;<list>[;<list>...]}
    

    Parameters

    • list - One or more semicolon-separated lists to sort

    Behavior

    • Combines all provided lists
    • Sorts elements alphabetically
    • Case-sensitive sorting (A-Z before a-z)
    • Returns comma-separated sorted list

    Examples

    Sort a simple list:

    ${sort;cherry,apple,banana}
    # Returns: "apple,banana,cherry"
    

    Sort with mixed case:

    ${sort;Zebra,apple,Ant,banana}
    # Returns: "Ant,Zebra,apple,banana"
    

    Sort multiple lists:

    ${sort;red,green;blue,yellow}
    # Returns: "blue,green,red,yellow"
    

    Sort and filter:

    ${sort;${filter;${packages};com\.example\..*}}
    

    Use Cases

    • Organizing lists alphabetically
    • Creating ordered reports
    • Sorting package or class names
    • Normalizing list order for comparison
    • Generating sorted documentation

    Notes

    • Case-sensitive lexicographic sorting
    • Uppercase letters sort before lowercase
    • For numeric sorting, use ${nsort}
    • See also: ${nsort} for numeric sorting
    • See also: ${reverse} to reverse order

    See test cases in MacroTestsForDocsExamples.java

Prev Next
Search
    • Home