bnd CLI Commands
The command line interface (bnd CLI) provides various tools to invoke bnd functions and features. It is using bndlib under the hood just like other tooling like bndtools, maven or gradle plugins do too.
Checkout the tutorial which makes use of the CLI.
Installation
See here to install the CLI.
Use
The bnd CLI 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
General Options
General Option | Description | |||
–debug | Show log debug output | |||
–failok | Turns errors into warnings so command always succeeds | |||
–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. |
Show list of all options for the bnd CLI.
Reference
page | Description | Class |
---|---|---|
action | Execute an action on a repo, or if no name is give, list the actions | |
add | Add a project, workspace, plugin or template fragment to the workspace | |
baseline | 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 | Build a project. This will create the jars defined in the bnd.bnd and sub-builders. | |
buildtool | Install the build tool | |
buildx | Build project, is deprecated but here for backward compatibility | |
bump | 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 | Show the changes in this release of bnd | |
classpath | Show the classpath with all the current -buildpath and optional -testpath dependencies | |
classtoresource | Convert class names to resource paths from stdin to stdout | |
clean | Clean a project or workspace | |
collect | Extract a set of resources from a set of JARs given a set of prefixes. All prefixes in any of the given input jars are added to the output jar | |
com | Commands to verify and check the communications settings for the http client. | |
compile | Compile a project or the workspace. DEPRECATED: This command will be removed in bnd 8.0. Use 'bnd build' for compile and build. | |
convert | Converter to different formats | |
copy | Copy a bundle, potentially stripping it | |
create | Create jar, used to support backward compatible java jar commands | |
debug | Show a lot of info about the project you're in | |
defaults | Show all the defaults in bnd | |
deliverables | Show all deliverables from this workspace. with their current version and path. | |
dependencies | Show the used workspace dependencies | |
diff | 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 eachother. | |
digest | Digests a number of files | |
do | Execute a file based on its extension. Supported extensions are: bnd (build), bndrun (run), and jar (print) | |
eclipse | Show info about the current directory's eclipse project | |
ees | Show the Execution Environments of a JAR | |
export | Export a bndrun file | |
exportreport | Generate and export reports of a workspace, a project or of a jar. | |
extract | Extract files from a JAR file, equivalent jar command x[vf] (syntax supported) | |
find | Go through the exports and/or imports and match the given exports/imports globs. If thet match print the file, package and version. | |
flatten | Flatten a bundle by expanding all entries on the Bundle-ClassPath | |
generate | Generate source code | |
generatemanual | Generate markdown files for bnd manual e.g. for all headers / instructions / commands defined in Syntax.java and bnd.java. You can point it the the /docs folder of the bnd manual, to add or regenerate pages. | |
gmd | Generate markdown documentation for all bnd CLI commands | |
graph | Commands to inspect a dependency graph of a set of bundles | |
grep | Grep the manifest of bundles/jar files. | |
index | Index bundles from the local file system | |
info | Show key project variables | |
junit | Test a project with plain JUnit | |
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 | |
mbr | Maintain Maven Bnd Repository GAV files | |
nexus | Nexus repository command. Provides a number of sub commands to manipulate a Nexus repository. | |
package | 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. | |
packagetoresource | Convert package names to resource paths from stdin to stdout | |
plugins | Show the loaded workspace plugins | |
Provides detailed view of the JAR / bundle. It will analyze the bundle and then show its contents from different perspectives. If no options are specified, prints the manifest. | ||
profile | Profile management. A profile is a JAR that only contains packages and capabilities | |
project | Execute a Project action, or if no params given, show information about the project | |
properties | Show the project or the workspace properties | |
release | Release this project | |
remote | Communicates with the remote agent | |
remove | Remove a project or a plugin from the workspace | |
repo | 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. | |
resolve | Resolve a number of bndrun files (either standalone or based on the workspace) and print the bundles | |
run | Run a project in the OSGi launcher. If not bndrun is specified, the current project is used for the run specification | |
runtests | Run OSGi tests and create report | |
schema | Highly specialized function to create an overview of package deltas in ees. 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 | Helps finding information in a set of JARs by filtering on manifest data and printing out selected information. | |
settings | Set bnd global variables. The key can be wildcard. | |
shell [options] | Open a shell on a project, workspace, or plain bnd defaults and exercise commands and macros | |
source | Merge a binary jar with its sources. It is possible to specify source path | |
sync | Force a cache update of the workspace | |
syntax | Access the internal bnd database of keywords and options | |
test | Test a project according to an OSGi test | |
type | List files int a JAR file, equivalent jar command t[vf] (syntax supported) | |
verify | Verify jars | |
version | Show version information about bnd | |
view | View a resource from a JAR file. Manifest will be pretty printed and class files are shown disassembled. | |
wrap | 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 | Shows the differences between two XML resource repositories | |
xref | Show a cross references for all classes in a set of jars. |