• 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
  • lsr ';' DIR (';' SELECTORS )

    Prev Next
    Macro
    List files with relative paths, optionally filtered

    Summary

    The lsr macro returns a comma-separated list of relative file paths from a directory, with optional filtering using selectors.

    Syntax

    ${lsr;<directory>[;<selector>...]}
    

    Parameters

    • directory - Directory path to list (relative to project base)
    • selector (optional) - One or more file selectors/patterns to filter results

    Behavior

    • Lists files in the specified directory
    • Returns relative paths (from the directory)
    • Optional filtering with selectors
    • Comma-separated output
    • Recursive by default

    Examples

    List all files:

    ${lsr;src/main/java}
    # Returns relative paths
    

    Filter by pattern:

    ${lsr;lib;*.jar}
    # Lists all JAR files with relative paths
    

    Find source files:

    ${lsr;src;*.java}
    # All Java source files
    

    Multiple patterns:

    ${lsr;resources;*.xml;*.properties}
    

    Use Cases

    • File discovery with relative paths
    • Source file collection
    • Resource listing
    • Build inputs
    • Pattern-based file selection

    Notes

    • Returns relative paths
    • Recursive listing
    • Selectors use file patterns
    • See also: ${lsa} for absolute paths
    • See also: ${glob} for pattern matching
    • See also: ${findfile} for filtered recursive search

    TODO Needs review - AI Generated content


    See test cases in MacroTestsForDocsExamples.java

Prev Next
Search
    • Home