Remove creation of module-info.java in Bnd project wizard
When creating a new Bnd OSGi Project via the wizard, a dialog will popup at the end asking if you want to create the module-info.java. If you select "Create" you start a hard time getting the newly created project to work.
- The created project shows directly compile errors.
This is because the module-info.java is empty and the osgi-annotations are not resolved then. Probably because the modulepath has higher priority than the Classpath. To fix this you need to know that you have to modify the module-info.java manually (I haven't found a working Quick Fix), e.g. like this:
module org.fipro.modifier.api {
requires static osgi.annotation;
}
- This adds the next issue, because osgi.annotation.jar is not available on the modulepath, it is not resolved. Fortunately there is a quick fix that proposes to move it from the Bnd Bundle Path to the modulepath.
- After applying the quick fix, you see a warning because the osgi.annotation.jar does not have an Automatic-Modulename (shouldn't it have one? Should there be another ticket for this?)
The above is only for an API Bundle. For a Provider Bundle additional steps come into place, like adding the API package, org.osgi.service.component.annotations, and exporting the implementation package (which is of course something confusing for an OSGi guy to export a private package, but well, surely an issue of JPMS compared to OSGi, not a topic of Bndtools).
Actually the only option to get a working project in the IDE and a working module at the end, is to always say "Don't Create". So the dialog is only confusing for users and doesn't create a real benefit. I would suggest to drop that dialog. If a user wants to manually create a module-info.java file, he can do, otherwise it should be generated.