Q: My test is not running and the console only tells me Main class aQute.launcher.Launcher could not be loaded. What could be the reason.

A: This is usually the case if you have a invalid run configuration. Try resolving you run config and resolve the issues here. Don’t forget to add the ${junit} and ${mockito} entries in the runbundles afterwards if you are using bnd 3.4 or older.

Advertisements

Q: How can I use @ProviderCapability and @RequireCapability Annotations?

A: Add the bundle biz.aQute.bnd.annotation to your bnd.bnd. It can be found in the latest release version in maven central. Note: These Annotations will move with R7 directly in the osgi spec and bundles and will be supported directly by bnd.

Using P2 Repositories with Bndtools

Bndtools support multiple types of repositories to grep artifacts from. For a while now P2 Repositories are supported as well, but information on how to add them are sparse and it is not obvious if you are new to bnd.

What to do:

Open the build.bnd in the cnf Project and switch to the source view. To add a repository add an entry like this:

-plugin.3.mars: \
 aQute.bnd.repository.p2.provider.P2Repository; \
 url = http://download.eclipse.org/releases/mars; \
 name = mars

My colleague urged me to give the following WARNING after he tried it himself: This example will cause bndtools do download the whole repository with all the content. Thus this may take a while!

We hope this might be helpful to you as well.