• Intro Headers Instructions Macros Commands
Fork me on GitHub
    • Introduction
    • How to install bnd
    • Guided Tour
    • Guided Tour Workspace & Projects
    • Concepts
    • Best practices
    • Build
    • Project Setup
    • Generating JARs
    • Versioning
    • Baselining
    • Service Components
    • Metatype
    • Contracts
    • Bundle Annotations
    • Accessor Properties
    • SPI Annotations
    • Resolving Dependencies
    • Launching
    • Startlevels
    • Testing
    • Testing with Launchpad
    • Packaging Applications
    • JPMS Libraries
    • Wrapping Libraries to OSGi Bundles
    • Generating Documentation
    • Commands
    • For Developers
    • Tips for Windows users
    • Tools bound to bnd
    • Reference
    • Headers
    • Instruction Reference
    • Instruction Index
    • Macro Reference
    • Macro Index
    • Plugins
    • External Plugins
    • Settings
    • Errors
    • Warnings
    • Frequently Asked Questions
  • Commands

    Use

    The command line tool can be invoked in several different ways:

    • bnd ‘‘general-options’’ ‘‘cmd’’ ‘‘cmd-options’’
    • bnd ‘‘general-options’’ ‘‘.jar''
    • bnd ‘‘general-options’’ ‘‘.bnd''

    In this text bnd is used as if it is a command line program. This should be set up as:

    java -jar .jar ...

    General Options

      !General Option   !Description  
      -failok   Same as the property -failok. The current run will create a JAR file even if there were errors.  
      -exceptions   Will print the exception when the software has ran into a bad exception and bails out. Normally only a message is printed. For debugging or diagnostic reasons, the exception stack trace can be very helpful.  

    Main options

    [ -f, --full ]             - Do full
    [ -p, --project <string> ] - Identify another project
    [ -t, --test ]             - Build for test
    [ -o, --output <string> ]  - Specify the output file path. The default is
                                output.jar in the current directory
    

    Reference

    page Description Class
    create Create a JAR
    baseline [options] <[newer jar]> <[older jar]> Compare a newer bundle to a baselined bundle and provide versioning advice.
    bash Generate autocompletion file for bash
    bnd The swiss army tool for OSGi
    bootstrap Interactive gogo shell
    bsn2url From a set of bsns, create a list of urls if found in the repo
    build [options] Build a project. This will create the jars defined in the bnd.bnd and sub-builders.
    buildx [options] Build project, is deprecated but here for backward compatibility. If you use it, you should know how to use it so no more info is provided.
    bump [options] <<major|minor|micro>> Bumps the version of a project. Will take the current version and then increment with a major, minor, or micro increment. The default bump is minor.
    changes [options] Show the changes in this release of bnd
    clean [options] ... Clean a project
    convert [options] <[from]> <[to]> Converter to different formats
    action [options] ... Equivalent jar command c[v0mf] command (supports the jar tool's syntax). Will wrap the bundle unless --wrapnot is specified
    debug [options] ... Show a lot of info about the project you're in
    defaults
    deliverables [options] Show all deliverables from this workspace. with their current version and path.
    diff [options] <[newer file]> <[older file]> Compares two jars. Without specifying the JARs (and when there is a current project) the jars of this project are diffed against their baseline in the baseline repository, using the sub-builder's options (these can be overridden). If one JAR is given, the tree is shown. Otherwise 2 JARs must be specified and they are then compared to each other.
    digest [options] <[file...]> Digest a number of files
    do [options] ... Execute a file based on its extension. Supported extensions are bnd (build), bndrun (run), and jar (print)
    eclipse pde [options] <[repo-dir]> <[...]> Import PDE projects into a bnd workspace
    eclipse [options] Show info about the current directory's eclipse project
    ees <[jar-file]...> Show the Execution Environments of a JAR
    exportreport <sub-cmd> [options] Generate and export reports of a workspace, a project or of a Jar.
    extract [options] ... Extract files from a JAR file, equivalent jar command x[vf] (syntax supported)
    find [options] <[file]...> Go through the exports and/or imports and match the given exports/imports globs. If they match, print the file, package and version.
    generate Generate autocompletion file for bash
    grep [options] <[pattern]> <[file]...> Grep the manifest of bundles/jar files.
    identity
    index [options] <[bundles]...> Index bundles from the local file system
    info [options] Show key project variables
    junit [options] <testclass[:method]...> Test a project according to an OSGi test
    macro [options] <[macro]> <[...]> Show macro value. Macro can contain the { and } parentheses but it is also ok without. You can use the ':' instead of the ';' in a macro
    maven ( 'settings' | 'bundle' Special maven commands
    package [options] <<bnd|bndrun>> <[...]> Package a bnd or bndrun file into a single jar that executes with java -jar <>.jar. The JAR contains all dependencies, including the framework and the launcher. A profile can be specified which will be used to find properties. If a property is not found, a property with the name [<profile>]NAME will be looked up. This allows you to make different profiles for testing and runtime.
    plugins [options] Execute a Project action, or if no parms given, show information about the project
    print [options] <[jar-file]...> Provides detailed view of the bundle. It will analyze the bundle and then show its contents from different perspectives. If no options are specified, prints the manifest.
    project [options] Execute a Project action, or if no parms given, show information about the project
    release [options] Release this project
    repo [options] <[sub-cmd]> ... Access to the repositories. Provides a number of sub commands to manipulate the repository (see repo help) that provide access to the installed repos for the current project.
    run [options] <[bndrun]> Run a project in the OSGi launcher. If not bndrun is specified, the current project is used for the run specification
    runtests [options] ... Run OSGi tests and create report
    schema [options] ... Print out the packages from spec jars and check in which ees they appear. Very specific. For example, schema ee.j2se-1.6.0 ee.j2se-1.5.0 ee.j2ee-1.4.0
    select [options] <[jar-path]> <[...]> Helps finding information in a set of JARs by filtering on manifest data and printing out selected information.
    settings [options] <[key][=<[value]>]...> Set bnd global variables. The key can be wildcarded.
    shell [options] Open a shell on a project, workspace, or plain bnd defaults and exercise commands and macros
    source [options] <[jar path]> <[source path]> Merge a binary jar with its sources. It is possible to specify source path
    sync [options] Execute a Project action, or if no parms given, show information about the project
    syntax [options] <header|instruction> ... Access the internal bnd database of keywords and options
    test [options] <testclass[:method]...> Test a project according to an OSGi test
    type [options] ... List files int a JAR file, equivalent jar command t[vf] (syntax supported)
    verify <[jar path]> <[...]> Verify jars
    version [options] Show version information about bnd
    view [options] <[jar-file]>> <[resource]> <[...]> View a resource from a JAR file. Manifest will be pretty printed and class files are shown disassembled.
    wrap [options] <[jar-file]> <[...]> Wrap a jar into a bundle. This is a poor man's facility to quickly turn a non-OSGi JAR into an OSGi bundle. It is usually better to write a bnd file and use the bnd <file>.bnd command because that has greater control. Even better is to wrap in bndtools.
    xmlrepodiff [options] <newer XML resource repository> <older XML resource repository> Compares two XML resource repositories
    xref [options] <[jar path]> <[...]> Show a cross references for all classes in a set of jars.
    • GitHub