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:
-
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. -
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.
-
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
package-info.java
file with the correct annotations. Rebuilding or cleaning the project does not fix the issue. Editing thebnd.bnd
file to add anExport-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 thecnf/ext/maven-layout.bnd
file, thetestsrc
directive only works with one path. Adding another one (for instancesrc/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.
Best,
Rubén