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.