• 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
  • thisfile

    Prev Next
    Processor
    Get the absolute path of the current properties file

    Summary

    The thisfile macro returns the absolute path to the properties file being processed. This provides the full path to the current .bnd, .bndrun, or other bnd configuration file.

    Syntax

    ${thisfile}
    

    Parameters

    None - this macro takes no parameters.

    Behavior

    • Returns the absolute path to the current properties file
    • Generates an error if no properties file is associated with the processor
    • The path uses OS-specific separators

    Examples

    Get current file path:

    Current-Config: ${thisfile}
    # Returns: "/path/to/project/bnd.bnd"
    

    Use in logging:

    Processing: ${thisfile}
    

    Reference in documentation:

    # Configuration defined in: ${thisfile}
    

    Conditional based on file:

    ${if;${endswith;${thisfile};test.bnd};test-mode;normal-mode}
    

    Use Cases

    • Debugging configuration files
    • Documenting which file defined settings
    • Logging and diagnostics
    • File-specific conditional logic
    • Build metadata
    • Tracing configuration sources

    Notes

    • Returns absolute path, not relative
    • Generates error if called without a properties file
    • Path includes the filename
    • See also: ${basedir} for the project directory
    • See also: ${propertiesname} for just the filename
    • See also: ${propertiesdir} for just the directory

    See test cases in MacroTestsForDocsExamples.java

Prev Next
Search
    • Home