Import a bnd workspace from Github

Hi there,

I am sorry to inaugurate the new bnd discourse group with a rant, but my experience with bndtools so far, apart from the creation of a new workspace and new projects in it, has been extremely frustrating.

To recap, the “happy path” of creating a new workspace, be it directly in the current Eclipse workspace or in a subfolder works without issues. Creating bnd projects in the workspace works also very well. Adding dependencies, managing the bundle repositories, etc… all goes well.

My problems started when I tried to upload my workspace to Git. If the bnd workspace is in the same folder as the Eclipse workspace (and not a subfolder), the IDE starts to throw errors because the Eclipse workspace is supposed to contain only project folders and Eclipse’s own configuration files (namely .metadata or perhaps some others). Because a bnd workspace may also contain Gradle and git configuracion files and folders, Eclipse gets confused. Peter told me that, because he he does not use EGit (the git plugin for Eclipse) and clones the Github repos with a external tool, he was not aware of those problems. Fair enough.

However I do not seem able to correctly import a workspace from Github either, regardless the way I try to import it:

  1. If I create a subfolder in the Eclipse workspace containing my bnd workspace (i.e. the cnf and project folders and several gradle configuration files which were generated by the default bndtools templates) and then use “Import existing bnd workspace”, it fails.

  2. If I clone the Github repository in a folder, then tell Eclipse to use that folder as a workspace, then use “Import existing bnd workspace”, it fails, too.

  3. If I clone the Github repository in a folder and then create a new bnd workspace in the same folder, it works, but the bnd projects are not imported. Because there is no option to import an existing Bnd project, I have to use the option “Create new bnd project”. If I enter the name and location of an existing project, it gets imported into Eclipse, but this does not work either:

    • The new project does not include the “Bnd Bundle Path” library that provides the bnd-managed dependencies. Therefore, all the dependencies coming from other bundles are not resolved. The library can be added by hand, though.

    • The bnd.bnd file is rewritten with an empty file (and why wouldn’t it? I’m telling Eclipse to create a new project after all). It is not the end of the world, because we can always revert the file to the previous version using Git, but still, another inconvenience.

    • Even when those issues are solved, the exported packages are not correctly exported. They all show as “excluded” in Eclipse’s Project Explorer, even when there is a file with the correct annotations. Rebuilding or cleaning the project does not fix the issue. Editing the bnd.bnd file to add an Export-Package directive fixes the problem, but I do not understand why it fails to recognize the @Export annotations.

    • Even if all these problems are solvable, this does not scale for big workspace. I have a very small test project with a handful projects… what happens if there are hundreds of projects? Importing them manually is not an option.

All in all, I see no practical way to download a bnd repository from Github, which is extremely frustrating.

Now, I cannot understand how there may be people using bndtools on a daily basis if the most simple operations are completely broken. I can only assume I am using an unsupported Eclipse version or doing something terribly wrong, but I have the latest Eclipse and bndtools version from the marketplace, so I cannot understand what the problem can be. My next step will be to report my experiences as bugs, but I wanted to comment those here first:

  • "Import Bnd Workspace" is completely broken. If the bnd workspace is in a subfolder of the Eclipse workspace (and not exactly the same folder), then the process fails without a meaningful warning. If the bnd workspace is the same folder as the Eclipse workspace, then the problem seems to be that some standard folders are missing (for instance src/java/resources). However, these standard paths should not be mandatory unless they are needed, shouldn’t they?

  • There is not mechanism to import an existing Bnd project into the workspace. Reloading a bnd workspace using the button at the top of the “Bndtools Explorer” does not discover new projects in the workspace. I’m not saying that it should, but then there should be a mechanism to do that. Using the “Create new Bnd project” menu and providing the path of an existing project does not work properly either – the “Bnd Bundle Path” JAR library is not automatically added to the project.

  • New Bnd project’s classpath is incomplete. In new projects (no matter if they are actually new projects or created on the location of a existing, not-yet-imported project), the build path looks like:


    As you can see, the “Default output folder” does not match the output folder settings of the individual entries (not so serious, but confusing at first). Also, the test entries (src/main/test) are missing. These Maven-style paths are used in the default “Empty” project template.

    Also, I have notice that, while one can add multiple paths to the src directive in the cnf/ext/maven-layout.bnd file, the testsrc directive only works with one path. Adding another one (for instance src/test/java, src/test/resources) will confuse bnd.

Please let me know if there is something I am doing wrong, and sorry for insisting on the same topics, but I really don’t see why I am having such a negative experience with exporting/importing the project to/from Github while: a) it seems to be a core concern of the plugin and b) it is apparently working seamlessly for others.

Thanks and sorry for the long rant.


Hi Ruben,

I know the mess you are talking about. Unfortunately in large parts an Eclipse issue and in small parts of bndtools. Eclipse and EGit in my opinion don’t take well a situation where your git repository is your eclipse workspace as well.

I had issues with maven or PDE in such a situation as well. Especially when you create projects in you eclipse workspace and share it later one, because egit moves you project to the defined git repository. Not sure if they fixed this, but this basically broke everything in the past.

This plays into something else: the bnd workspace is something basically unrelated to the eclipse workspace. This often gets confused because of the names. Never have or create a bnd workspace (especially with git) in your eclipse workspace.

My tried and true methods that might cover you cases are:

** New Project that will be committed somewhere later**

  • Create your eclipse workspace in folder A
  • Create or clone an empty Git repo in folder B that is no subfolder of A
  • Create your bndworkspace with bndtools in B and make sure new projects are always next to the cnf folder in b

Import an existing project form git

  • Create your eclipse workspace in folder A
  • Clone your Git Repo to folder B that is no subfolder of A
  • Use Import Existing Bnd Workspace if B contains a cnf folder

** Importing bnd projects that have been added e.g. via a git commit and do not contain a .project file**

  • make sure the project is next to the cnf file
  • use import existing bnd workspace to detect new projects

To conclude:

  • The eclipse workspace is not equal to the bnd workspace
  • If you want to share your workspace via git, never create your bnd workspace in your eclipse workspace
  • Never copy projects to a new location (or have eclipse do it)

I hope this helps,


1 Like

Bnd(tools) has only one simple rule to recognize a workspace, the cnf directory with the build.bnd file. Git has a similar rule with the .git directory and Eclipse has the .metadata folder. Inside Eclipse, bnd does not care where the other workspace are as long as it sees a cnf directory. New projects are then automatically created in the same bnd workspace folder.

I do like the single folder approach for all 3 workspace (Git/Eclipse/bnd) and it works fine for me. I’ve made a video how I clone an external project. I used EGit to show that you can do it all from Eclipse. The key is to:

In any Eclipse
With EGit, clone a repository to a workspace folder, e.g. ~/git/biz.aQute.osgi.util
Switch to a new Eclipse workspace: ~/git/biz.aQute.osgi.util
Import the projects from ~/git/biz.aQute.osgi.util

There are two caveats I see:

Make sure .gitignore contains .metadata
Do not use git clean -fdx, this blows away the Eclipse .metadata folder

You can find the video here:

Kind regards,

Peter Kriens